Exemplo n.º 1
0
def login():
    form = LoginForm()
    if form.validate_on_submit():
        user = User.find_by_email(form.email.data)

        if user is not None and user.check_password(form.password.data):
            login_user(user)
            flash("მომხმარებელმა წარმატებით გაიარა ავტორიზაცია")

            next = request.args.get('next')

            if next is None:
                next = url_for('welcome')

            return redirect(next)

    return render_template('login.html', form=form)
Exemplo n.º 2
0
 def validate_email_from_db(self, email):
     temp_email = self.email.data
     if User.find_by_email(temp_email):
         raise ValidationError("Email already exists")