Ejemplo n.º 1
0
def signup():
    check_args(g.args, 'name', 'password')
    u = user.new_user(
        g.args['name'],
        g.args['password'],
        g.args)
    return {'message': 'signup successful', 'user': u}
Ejemplo n.º 2
0
def u_email(u_email):
    u_profile = new_user(web.get_db()).profile(u_email)
    if request.method == 'POST':
        email = request.form["email"]
        lastname = request.form["lastname"]
        firstname = request.form["firstname"]
        is_admin = request.form.get('u_isadmin', 'off') == 'on'
        new_user(web.get_db()).changeProfile(u_email, email, firstname,
                                             lastname, is_admin)
        url = '/admin/user_profile/' + email
        return redirect(url_for('userlist'))
    return render_template('admin/user_profile.html',
                           id=u_profile['id'],
                           email=u_profile['email'],
                           lastname=u_profile['lastname'],
                           firstname=u_profile['firstname'],
                           is_admin=u_profile['is_admin'])
def confirm_email(token):
    try:
        config = web.get_config()
        email = confirm_token(token)
        if email is False:
            return render_template("/inforPage.html",
                                   infor="Oops, link expired, please sign up again",
                                   **dict(gauth_key=config['GAUTH_KEY'],
                                          fb_key=config['FB_KEY']))
    except:
        flash('The confirmation link is invalid or has expired.', 'danger')
    user = new_user(web.get_db()).getuser(email)

    if user.u_isconfirmed:
        return render_template("/inforPage.html",
                               infor="Account confirmed. Please login.", **dict(gauth_key=config['GAUTH_KEY'],
                                                                                fb_key=config['FB_KEY']))
    else:
        new_user(web.get_db()).confirm(email)
        return render_template("/inforPage.html",
                               infor="Congratulations! Confirmation complete. Thanks for your patient!",
                               **dict(gauth_key=config['GAUTH_KEY'],
                                      fb_key=config['FB_KEY']))
def signup():
    if request.method == 'POST':
        config = web.get_config()
        user_email = request.form["u_email"]
        user_firstname = request.form["u_firstname"]
        user_lastname = request.form["u_lastname"]
        user_password = request.form["u_password"]
        user_age = request.form["u_age"]
        user_gender = request.form["user[gender]"]
        if new_user(web.get_db()).check_email(user_email):
            new_user(web.get_db()).user(user_email, user_firstname, user_lastname, user_password, user_age, user_gender)
            send = send_confirm_email
            token = generate_confirmation_token(user_email)
            confirm_url = url_for('confirm_email', token=token, _external=True)
            send(user_email, confirm_url)
            return render_template("/inforPage.html",
                                   infor="Please wait for a while and confirm your verification email. Thanks!",
                                   **dict(gauth_key=config['GAUTH_KEY'],
                                          fb_key=config['FB_KEY']))
        else:
            return render_template("/inforPage.html",
                                   infor="Oops, this user has already existed!",
                                   **dict(gauth_key=config['GAUTH_KEY'], fb_key=config['FB_KEY']))
Ejemplo n.º 5
0
def userlist():
    allemail = new_user(web.get_db()).all_email()
    return render_template('admin/user.html', allemail=allemail)
Ejemplo n.º 6
0
def signup():
    check_args(g.args, 'name', 'password')
    u = user.new_user(g.args['name'], g.args['password'], g.args)
    return {'message': 'signup successful', 'user': u}