def create(): # @A1aaaaa alerts = User.validate(request.form) if len(alerts) > 0: print(len(alerts)) if len(alerts) == 5: print(len(alerts)) flash('All fields are required!') return redirect('/portfolio/user/register') else: print(len(alerts)) for alert in alerts: flash(alert) return redirect('/portfolio/user/register') else: User.create(request.form) return redirect('/portfolio/user/thankyou')
def create(): errors = User.validate(request.form) if errors: for error in errors: flash(error) return redirect(url_for('users:login_and_registration')) user_id = User.create(request.form) session['user_id'] = user_id return redirect(url_for("dashboard"))
def post(self, args): """Register user.""" user = User.query.filter_by(email=args['email']).first() if user: return 'Email already registered', 409 new_user = User.create(email=args['email'], password=args['password']) send_confirmation_email(new_user.email) return marshal(new_user, resource_fields), 201
def create(): # @A1aaaaa alerts = User.validate(request.form) if len(alerts) > 0: print(alerts) if len(alerts) == 10: flash('All fields are required!') # return redirect('/user/register') return render_template('/partials/alerts.html'), 500 else: for alert in alerts: flash(alert) # return redirect('/user/register') return render_template('/partials/alerts.html'), 500 else: user_id = User.create(request.form) session['user_id'] = user_id return redirect('/user/thankyou')
def test_check_password(self): """Check password.""" user = User.create(email='*****@*****.**', password='******') assert user.check_password('foobarbaz123') is True assert user.check_password('barfoobaz') is False