Пример #1
0
def process_login():
    email = request.form.get("email")
    password = request.form.get("password")
    user = model.get_user_from_email(email)

    if user == None:
        flash("This customer is not registered yet")
        return redirect('signup')
    else:
        session['user'] = user.id
        return redirect('/user_list')
Пример #2
0
def process_login():
    email = request.form.get("email")
    password = request.form.get("password")
    user = model.get_user_from_email(email)

    if user == None:
        flash ("This user is not registered yet")
        return redirect('signup')
    else:
        session['user'] = user.id
        return redirect('/user_list')
Пример #3
0
def process_login():
    email = request.form.get('email')
    password = request.form.get('password')

    #Get USER OBJECT from EMAIL, return OBJECT or NONE
    user = model.get_user_from_email(email)

    if user != None:
        
        if int(user.password) == hash(password):
            session['user_id'] = user.id
            return redirect(url_for("all_users"))
        else:
            flash("Password incorrect, please try again.")
            return redirect(url_for("login"))

    else:
        flash("Email not found, please register")
        return redirect(url_for("login"))
Пример #4
0
def process_registration():
    email = request.form.get('email')
    password = request.form.get('password')
    confirm_password = request.form.get('confirm_password')
    age = request.form.get('age')
    zipcode = request.form.get('zipcode')

    user_id = model.get_user_from_email(email)

    if user_id != None:
        flash("Already registered, please login")
    else:
        if password == confirm_password:
            model.register_user(email, hash(password), int(age), zipcode)
            flash("you've been successfully registered!")
            return redirect(url_for("login"))

            #redirect to userpage
        else:
            flash("Passwords do not match")
            return redirect(url_for("register"))
def process_login():
    email = request.form.get("email")
    password = request.form.get("password")
    user = model.get_user_from_email(email)

    if user == None:
        flash("This user is not registered yet")
        model.add_pageview(
            user_id=None,
            item_id=None,
            page="login",
            activity_type="non-registered id / incorrect details",
            rating=None)  #pageview
        return redirect('signup')
    else:
        session['user'] = user.id
        model.add_pageview(user_id=user.id,
                           item_id=None,
                           page="login",
                           activity_type="successful login",
                           rating=None)  #pageview
        return redirect(url_for('show_user_details', id=user.id))