예제 #1
0
def newAccount(credentials):
    if b':' not in credentials:
        return (error.InvalidMsg, )
    username, password = credentials.split(b':')

    try:
        # Account creation succeeded
        if db.newAccount(username, password):
            return (error.Success, )
    except:
        return (error.DBError, )

    # Account creation failed
    return (error.DuplicateUser, )
예제 #2
0
def signup():
    if request.method == 'GET':
        return render_template('signup.html')
    if request.method == 'POST' and request.form['button'] == 'Sign up':
        username = request.form["username"]
        password = request.form["password"]
        firstname = request.form["firstname"]
        lastname = request.form["lastname"]
        if (username and password and firstname and lastname):
            success = db.newAccount(username, password, firstname, lastname, request.form["email"], "play")			
            if success:
                flash('User created successfully.', 'success')
                return redirect("/")
            else:
                flash('User with that name already exists.', 'alert')
                return render_template('signup.html')
        else:
            flash('One or more of the required fields is empty.', 'alert')
            return render_template('signup.html')
예제 #3
0
def new_user(resp):
    session['openid'] = resp.identity_url
    if db.exist_user(session['openid']) is None:
        db.newAccount(session['openid'], "", resp.fullname, "", resp.email, "open")       
    return redirect(oid.get_next_url())