def user_register_validator(form, values): exception = Invalid(form, 'There was a problem with your submission') if values['password'] != values['confirm_password']: exception['confirm_password'] = '******' user = User.objects(name=values['name']) if user: exception['name'] = 'You have to choose a unique name' user = User.objects(email=values['email']) if user: exception['email'] = 'Email already exists in our database' if exception.children: raise exception
def user_inner_validator(form, values): exception = Invalid(form, 'There was a problem with your submission') if values['password'] and values['password'] != values['confirm_password']: exception['confirm_password'] = '******' user = User.objects(name=values['name']) if user and values['name'] != current_user.name: exception = unique_exception(exception, 'name') user = User.objects(email=values['email']) if user and values['email'] != current_user.email: exception = unique_exception(exception, 'email') if exception.children: raise exception
def add_user_to_request(event): request = event.request userid = authenticated_userid(request) if (userid): request.user = User.objects().with_id(userid)
def admin_user(request): return { 'users': User.objects() }