diff --git a/ordr2/views/account.py b/ordr2/views/account.py index ff579cd..065fa2b 100644 --- a/ordr2/views/account.py +++ b/ordr2/views/account.py @@ -4,6 +4,7 @@ from pyramid.security import remember, forget from pyramid.view import view_config from ordr2.models import User +from ordr2.schemas.account import RegistrationSchema # user log in and log out @@ -12,7 +13,8 @@ from ordr2.models import User name='login', permission='login', request_method='GET', - renderer='ordr2:templates/account/login.jinja2') + renderer='ordr2:templates/account/login.jinja2' + ) def login_form(context, request): ''' display a login form ''' return {} @@ -22,7 +24,8 @@ def login_form(context, request): context='ordr2:resources.Account', name='login', permission='login', - request_method='POST') + request_method='POST' + ) def login(context, request): ''' loging in a user ''' username = request.POST.get('username') @@ -65,3 +68,17 @@ def logout(context, request): request.resource_path(request.root, 'about'), headers=headers ) + + +# user registration + +@view_config( + context='ordr2:resources.Account', + name='register', + permission='register', + renderer='ordr2:templates/account/register.jinja2' + ) +def registration_form(context, request): + context.nav_highlight = 'register' + form = RegistrationSchema.as_form(request) + return {'form': form}