Example #1
0
def login():
    """ Called when an API user wishes to log in. """
    if 'email' not in request.form or 'password' not in request.form:
        return (JSON_FAILURE(), 401)

    email = request.form['email']
    submitted_password = request.form['password']
    this_user = User.log_user_in(email, submitted_password)

    if not this_user:
        return (JSON_FAILURE(), 401)

    return JSON_SUCCESS(user_token=this_user.new_token())
Example #2
0
def loginportal():
    if request.method == 'POST':
        email, pw = request.form['email'], request.form['password']
        if email and pw:
            user = User.log_user_in(email, pw)
            if user:
                session['email'] = email
                return redirect(url_for('WebInterface.dashboard'))

        flash("Incorrect Username or Password! Please check and try again.",
              'error')
        return render_template('login.html')
    else:
        return render_template('login.html')
Example #3
0
def login():
    """ Called when an API user wishes to log in. """
    if 'email' not in request.form or 'password' not in request.form:
        return (JSON_FAILURE(), 401)

    email = request.form['email']
    submitted_password = request.form['password']
    this_user = User.log_user_in(email, submitted_password)

    if not this_user:
        return (JSON_FAILURE(), 401)

    return JSON_SUCCESS(
        user_token=this_user.new_token()
        )
Example #4
0
def ensure_default_account():
    email = Context.email
    pw = Context.passwd
    if not User.log_user_in(email, pw):
        new_user = User(email, pw)
        new_user.save()
Example #5
0
def ensure_default_account():
    email = Context.email
    pw = Context.passwd
    if not User.log_user_in(email, pw):
        new_user = User(email, pw)
        new_user.save()