Esempio n. 1
0
def login():
    '''
    Display a login form and show validation errors as necessary.
    If they were trying to access a URL requiring login, remember this URL, so
    we can redirect to it after successful login.
    '''
    next = request.args.get('n',u'')
    username = request.args.get('u',u'')
    error = helpers.getInt(request.args.get('r'))

    # determine whether or not to override focus to password
    f = helpers.validate(request.args.get('f'), ['username','password'])
    if not f:
        f = False if (username is u'') else 'password'

    return render_template('login.html', links=False, next=next, u=username,
                           oFocus=f, err=error)
Esempio n. 2
0
def register():
    '''
    Display a registration form.
    '''
    next = request.args.get('n',u'')
    username = request.args.get('u',u'')
    email = request.args.get('e',u'')
    error = helpers.getInt(request.args.get('r'))

    # determine whether or not to override focus to password
    f = False
    if username is not u'':
        if email is u'':
            f = 'email'
        else:
            f = 'password'

    return render_template('register.html', links=False, next=next, u=username,
                           e=email, oFocus=f, err=error)