Esempio n. 1
0
def login():
    if current_user.is_authenticated():
        return redirect(url_for('index'))

    form = LoginForm()

    if form.validate_on_submit():
        user = Advertiser.objects(email=form.email.data).first()

        print(user.password)
        print(form.password.data)
        if user.password != form.password.data:
          return render_template('login.html', form=form, error="Wrong username or password")

        else:
          login_user(user)
          return redirect(url_for('index'))

    return render_template('login.html', form=form)
Esempio n. 2
0
def login():
    if current_user.is_authenticated():
        return redirect(url_for('index'))

    form = LoginForm()

    if form.validate_on_submit():
        user = Advertiser.objects(email=form.email.data).first()

        print(user.password)
        print(form.password.data)
        if user.password != form.password.data:
            return render_template('login.html',
                                   form=form,
                                   error="Wrong username or password")

        else:
            login_user(user)
            return redirect(url_for('index'))

    return render_template('login.html', form=form)
Esempio n. 3
0
def load_user(user_id):
    return Advertiser.objects(id=user_id).first()
Esempio n. 4
0
def load_user(user_id):
    return Advertiser.objects(id=user_id).first()