Example #1
0
def create_profile():
    """If this is the user's first login, the create_or_login function
    will redirect here so that the user can set up his profile.
    """
    if g.user is not None or 'openid' not in session:
        return redirect(url_for('index'))
    if request.method == 'POST':
        name = request.form['name']
        email = request.form['email']
        if not name:
            flash(u'Error: you have to provide a name', 'error')
        elif '@' not in email:
            flash(u'Error: you have to enter a valid email address', 'error')
        else:
            flash(u'Profile successfully created', 'success')
            user = User(name, email, session['openid'])
            user.insert()
            safe_commit()
            return redirect(oid.get_next_url())
    return render_template('create_profile.html', next_url=oid.get_next_url())
Example #2
0
def get_user_queue(user_id):
    quser = User.get(user_id)
    return render_template('queue.html', quser=quser)