예제 #1
0
파일: main.py 프로젝트: graycarl/bottlog
def login_check():
	username = request.POST.username.strip()
	password = request.POST.password.strip()
	if users.verify_user(username, password):
		users.set_cookie(response)
		redirect("/admin")
	else:
		redirect("/login/error")
예제 #2
0
파일: flask_app.py 프로젝트: jgilik/gitzebo
def auth_helper():
    request.user = None
    auth = request.authorization
    if not auth:
        return
    user = verify_user(auth.username, auth.password)
    if not user:
        return
    request.user = user
    return
예제 #3
0
파일: flask_app.py 프로젝트: jgilik/gitzebo
def auth_helper():
    request.user = None
    auth = request.authorization
    if not auth:
        return
    user = verify_user(auth.username, auth.password)
    if not user:
        return
    request.user = user
    return
예제 #4
0
파일: main.py 프로젝트: samiur98/Kpoll
def start_poll():
    # Provides I/O for starting a poll, Verifies user through the cassandra server.
    # Records Votes through the Kafka Consumer, soon as vote is finished persists the data long term through the cassandra server.
    print(
        "Please enter your username. You must be a registered user to create a poll"
    )
    username = input()
    print("Please Enter your password")
    password = input()
    status_code = verify_user(username, password)
    start_poll_helper(status_code, username)
예제 #5
0
def login():
    if request.method == 'POST':
        email = request.form['email']
        password = request.form['password']
        user = verify_user(password=password, email=email)
        if user:
            session['userid'] = user[0]
            return render_template('home.html', user=user)
        else:
            msg = 'Invalid email or password'
            return render_template('login.html', msg=msg)

        return
    elif request.method == 'GET':
        return render_template('login.html');
예제 #6
0
def login():
    form = LoginForm()
    if form.validate_on_submit():
        username = form.username.data
        # Not hashed or salted on either end, I leave that to you.
        password = form.password.data
        correct = False
        if form.login.data:
            correct = users.verify_user(username, password)
        elif form.register.data:
            correct = users.add_user(username, password)
        # If registering or logging in went well. Could rename this "success".
        if correct:
            user = User(username)
            login_user(user)
            return redirect("/settings")
        else:
            return ("We couldn't create your user or log you in",
                    "for some odd reason.",
                    "Either your username or password is wrong,",
                    "or your username is already taken.")
    else:
        return render_template("login.html", form=form)