Merge pull request #39 from alphagov/add_password_update

Added support for allowing password to updated from the PUT request t…
This commit is contained in:
Adam Shimali
2016-01-28 11:54:26 +00:00
4 changed files with 87 additions and 15 deletions

View File

@@ -9,7 +9,10 @@ def create_secret_code():
return ''.join(map(str, random.sample(range(9), 5)))
def save_model_user(usr, update_dict={}):
def save_model_user(usr, update_dict={}, pwd=None):
if pwd:
usr.password = pwd
usr.password_changed_at = datetime.now()
if update_dict:
if update_dict.get('id'):
del update_dict['id']