Пример #1
0
def register():
    form = uforms.RegisterForm(request.form)
    if form.validate_on_submit():
        user = umodels.User.create(form.username.data, form.password.data)
        login_user(user)
        flash.info('Welcome {}.'.format(str(user)))
        return redirect(request.args.get('next', url_for('app.home')))
    return render_template('user/register.html', form=form)
Пример #2
0
 def test_flash_different_categories(self):
     """Ensure all 4 categories work properly"""
     success(self.simple_message)
     warning(self.simple_message)
     info(self.simple_message)
     danger(self.simple_message)
     self.assert_flashes(self.simple_message, 'success')
     self.assert_flashes(self.simple_message, 'warning')
     self.assert_flashes(self.simple_message, 'info')
     self.assert_flashes(self.simple_message, 'danger')
Пример #3
0
def login():
    form = LoginForm(request.form)

    if request.method == "POST":
        user = UserHandler.login(form)
        if user:
            flash.info('Welcome "{}".'.format(user.username))
            return redirect(request.args.get('next', url_for('app.home')))

    return render_template('user/login.html', form=form)
Пример #4
0
def login():
    form = LoginForm(request.form)

    if request.method == "POST":
        user = UserHandler.login(form)
        if user:
            flash.info('Welcome "{}".'.format(user.username))
            return redirect(request.args.get('next', url_for('app.home')))

    return render_template('user/login.html', form=form)
 def test_flash_different_categories(self):
     """
     Ensure all 4 categories work properly
     """
     success(self.simple_message)
     warning(self.simple_message)
     info(self.simple_message)
     danger(self.simple_message)
     self.assert_flashes(self.simple_message, 'success')
     self.assert_flashes(self.simple_message, 'warning')
     self.assert_flashes(self.simple_message, 'info')
     self.assert_flashes(self.simple_message, 'danger')
Пример #6
0
def login():
    form = uforms.LoginForm(request.form)
    if request.method == 'POST':
        if form.validate_on_submit():
            user = umodels.User.objects.filter(
                username=form.username.data).first()
            if user and check_password_hash(user.password, form.password.data):
                login_user(user)
                flash.info('Welcome {}.'.format(str(user)))
                return redirect(request.args.get('next', url_for('app.home')))
            else:
                flash.warning('Invalid Credentials. Please try again.')

    return render_template('user/login.html', form=form)
Пример #7
0
def logout():
    logout_user()
    flash.info('You were logged out.')
    return redirect(url_for('app.home'))
Пример #8
0
def settings():
    flash.info('Welcome to your dashboard {}.'.format(str(current_user)))
    return render_template('user/settings.html')
Пример #9
0
def logout():
    UserHandler.logout()
    flash.info(u'You were logged out.')
    return redirect(url_for('app.home'))
Пример #10
0
def settings():
    flash.info('Welcome to your dashboard "{}".'.format(current_user.username))
    return render_template('user/settings.html')
Пример #11
0
def logout():
    UserHandler.logout()
    flash.info(u'You were logged out.')
    return redirect(url_for('app.home'))
Пример #12
0
def settings():
    flash.info('Welcome to your dashboard "{}".'.format(current_user.username))
    return render_template('user/settings.html')