def register_post(self): vm = RegisterViewModel() vm.from_dict(self.request.POST) vm.validate() if vm.error: return vm.to_dict() account = AccountService.find_account_by_email(vm.email) if account: vm.error = "An account with this email already exists. " \ "Please log in instead." return vm.to_dict() account = AccountService.create_account(vm.email, vm.password) print("Registered new user: "******"Redirecting to account index page...") self.redirect('/account')
def register_post(self): print("Calling register via POST...") vm = RegisterViewModel() vm.from_dict(self.request.POST) vm.validate() if vm.error: return vm.to_dict() # validate no account exists, passwords match # create account in DB # send welcome email # redirect print("Redirecting to account index page...") self.redirect('/account')
def register_post(self): vm = RegisterViewModel() vm.from_dict(self.request.POST) # print(f'Calling register via POST: {vm.email}, {vm.password}, {vm.confirm_password}') vm.validate() if vm.error: return vm.to_dict() # validations: no account exists, passwords match # create account in DB # send welcome email print("Redirecting to account index page...") self.redirect('/account') return{}
def register_post(self): vm = RegisterViewModel() vm.from_dict(self.request.POST) vm.validate() if vm.error: return vm.to_dict() # TODO: Create user in DB # validate no account exists, passwords match # create account in DB # send welcome email # redirect print("Redirecting to account index page...") self.redirect('/account')
def register_get(self): print("Calling register via GET...") vm = RegisterViewModel() return vm.to_dict()
def register_get(self): print('Calling register via get...') vm = RegisterViewModel() return vm.to_dict()
def register_get(self): vm = RegisterViewModel() return vm.to_dict()