diff --git a/ordr/resources/account.py b/ordr/resources/account.py index 6f7d596..d1b38d9 100644 --- a/ordr/resources/account.py +++ b/ordr/resources/account.py @@ -5,7 +5,7 @@ import deform from pyramid.security import Allow, Everyone, DENY_ALL from ordr.models.account import Token, TokenSubject -from ordr.schemas.account import RegistrationSchema +from ordr.schemas.account import RegistrationSchema, ResetPasswordSchema from .helpers import BaseChildResource @@ -77,6 +77,17 @@ class PasswordResetTokenResource(BaseChildResource): ''' access controll list for the resource ''' return [(Allow, Everyone, 'view'), DENY_ALL] + def get_reset_form(self, **kwargs): + ''' returns password reset form ''' + settings = { + 'buttons': ( + deform.Button(name='change', title='Set New Password'), + deform.Button(name='cancel', title='Cancel'), + ) + } + settings.update(kwargs) + return self._prepare_form(ResetPasswordSchema, **settings) + class PasswordResetResource(BaseChildResource): ''' The resource for resetting a forgotten password diff --git a/ordr/schemas/account.py b/ordr/schemas/account.py index 56f2730..215bd18 100644 --- a/ordr/schemas/account.py +++ b/ordr/schemas/account.py @@ -44,3 +44,13 @@ class RegistrationSchema(CSRFSchema): widget=deform.widget.CheckedPasswordWidget(), validator=colander.Length(min=8) ) + + +class ResetPasswordSchema(CSRFSchema): + ''' reset a forgotten password registration ''' + + password = colander.SchemaNode( + colander.String(), + widget=deform.widget.CheckedPasswordWidget(), + validator=colander.Length(min=8) + ) diff --git a/ordr/scripts/initializedb.py b/ordr/scripts/initializedb.py index 6eb9650..e7c6492 100644 --- a/ordr/scripts/initializedb.py +++ b/ordr/scripts/initializedb.py @@ -17,7 +17,7 @@ from ..models import ( get_session_factory, get_tm_session, ) -from ..models import Role, User +from ..models import Role, User def usage(argv): diff --git a/ordr/templates/account/forgotten_password_completed.jinja2 b/ordr/templates/account/forgotten_password_completed.jinja2 new file mode 100644 index 0000000..196e65e --- /dev/null +++ b/ordr/templates/account/forgotten_password_completed.jinja2 @@ -0,0 +1,33 @@ +{% extends "ordr:templates/layout.jinja2" %} + +{% block content %} +
+ Step 1: Validate Account +
++ Step 2: Change Password +
++ Step 3: Finished +
+