use OkupyCipher and improve helper functions

Some improvements:
1) Replaced edpwd with the new OkupyCipher
2) Splitted set_secondary_password into two functions
3) Move try/except into views.py