def signup():
    form = SignupForm()

    if form.validate_on_submit():
        u = User()

        form.populate_obj(u)
        u.password = User.encrypt_password(request.form.get('password', None))
        u.save()

        if login_user(u):
            flash(_('Awesome, thanks for signing up!'), 'success')
            return redirect(url_for('user.welcome'))

    return render_template('user/signup.jinja2', form=form)
def signup():
    form = SignupForm()

    if form.validate_on_submit():
        u = User()

        form.populate_obj(u)
        u.password = User.encrypt_password(request.form.get('password', None))
        u.save()

        if login_user(u):
            flash(_('Awesome, thanks for signing up!'), 'success')
            return redirect(url_for('user.welcome'))

    return render_template('user/signup.jinja2', form=form)
Exemple #3
0
    def test_is_last_admin_no(self, users, token):
        """ Not the last admin should be able to change himself. """
        user = User.find_by_identity('*****@*****.**')

        params = {
            'role': 'admin',
            'email': '*****@*****.**',
            'password': '******'
        }

        new_user = User(**params)
        new_user.save()

        assert User.is_last_admin(user, 'member', 'y') is False
        assert User.is_last_admin(user, 'admin', None) is False
        assert User.is_last_admin(user, 'member', None) is False