Move signin to use AJAX. Render all flask templates with the common header. Move the header to a partial. Add account recovery.

This commit is contained in:
yackob03 2013-10-14 17:50:07 -04:00
parent e182163d34
commit 4c15072c5a
17 changed files with 653 additions and 617 deletions

View file

@ -109,6 +109,29 @@ def confirm_user_email(code):
return user
def create_reset_password_email_code(email):
try:
user = User.get(User.email == email)
except User.DoesNotExist:
raise InvalidEmailAddressException('Email address was not found.');
code = EmailConfirmation.create(user=user, pw_reset=True)
return code
def validate_reset_code(code):
try:
code = EmailConfirmation.get(EmailConfirmation.code == code,
EmailConfirmation.pw_reset == True)
except EmailConfirmation.DoesNotExist:
return None
user = code.user
code.delete_instance()
return user
def get_user(username):
try:
return User.get(User.username == username)