Ejemplo n.º 1
0
def signup_post():
    form = SignupForm(request.forms)
    if form.validate():
        user = User()
        form.populate_obj(user)
        user.save()
        login.login_user(user.id)
        send_confirm_email(app.config, user.email)
        return redirect('/active_email')
    return {'form': form, 'token': request.csrf_token}
Ejemplo n.º 2
0
def signup_post():
    form = SignupForm(request.forms)
    if form.validate():
        user = User()
        form.populate_obj(user)
        user.save()
        login.login_user(user.id)
        send_confirm_email(app.config, user.email)
        return redirect('/active_email')
    return {'form': form, 'token': request.csrf_token}
Ejemplo n.º 3
0
def signup():
    form = SignupForm()
    if request.method == 'GET':
        return render_template('users/signup.html', form=form)
    else:
        if form.validate_on_submit():
            user = User()
            form.populate_obj(user)
            user.save()
            bookmark = Bookmark(user=user,
                                title=u"%s 的收藏夹" % user.username,
                                is_default=True)
            bookmark.save()
            user_mixin = LoginManagerUser(user)
            login_user(user_mixin)
            send_confirm_email(current_app.config, user.email)
            return redirect(url_for('site_app.index'))
        return render_template('users/signup.html', form=form)
Ejemplo n.º 4
0
def signup():
    form = SignupForm()
    if request.method == 'GET':
        return render_template('users/signup.html',
                               form=form)
    else:
        if form.validate_on_submit():
            user = User()
            form.populate_obj(user)
            user.save()
            bookmark = Bookmark(user=user,
                                title=u"%s 的收藏夹" % user.username,
                                is_default=True)
            bookmark.save()
            user_mixin = LoginManagerUser(user)
            login_user(user_mixin)
            send_confirm_email(current_app.config, user.email)
            return redirect(url_for('site_app.index'))
        return render_template('users/signup.html',
                               form=form)
Ejemplo n.º 5
0
def signup_get():
    if request.user:
        redirect('/')
    else:
        return {'form': SignupForm(), 'token': request.csrf_token}