예제 #1
0
def logout():
    # Logs out the user by clearing the login on PubCookie and clearing the session.
    log_access('logout')
    auth.remove_auth()
    if config.USES_PUBCOOKIE:
        return redirect("/LOGOUT-CLEARLOGIN")
    else:
        return redirect(url_for('home'))
예제 #2
0
def me():
    # My details page, allows users to update their basic information.
    message = None
    log_access('me')

    if request.method == 'POST':
        model.update_user(request.form)
        log_access('me', 'saved form')
        message = "Saved."
        if request.form['username'] != session['user_username']:
            auth.remove_auth()
            return redirect(url_for('me'))

    form=model.get_user(session['user_id'])
    return render_template('user_edit.html',
                           form=form,
                           message=message,
                           user_auth_levels=get_authorization_levels(session['user_auth_level']),
                           form_action_url=url_for('me'),
                           title="My Details",
                           delete_button = False,
                           change_password_button = True)