def login(): form = LoginForm() if form.validate_on_submit(): db_sess = db_session.create_session() user = db_sess.query(User).filter(User.email == form.email.data).first() if user and user.check_password(form.password.data): login_user(user, remember=form.remember_me.data) return redirect("/") return render_template('login.html', message="Неправильный логин или пароль", form=form) return render_template('login.html', title='Авторизация', form=form)
def login(): form = LoginForm() if form.validate_on_submit(): session = db_session.create_session() global user user = session.query(User).filter(User.email == form.email.data).first() if user and user.check_password(form.password.data): login_user(user, remember=True) return redirect("//127.0.0.1:8080") return render_template('login.html', message="Неверный логин или пароль", form=form, base_url="//127.0.0.1:8080", header=1) return render_template('login.html', title='Войти | Shoper', form=form, base_url="//127.0.0.1:8080", header=1)
def login(): db_session.global_init('db/blogs.sqlite') form = LoginForm() if form.validate_on_submit(): session = db_session.create_session() user = session.query(User).filter( User.email == form.email.data).first() if user and user.check_password(form.password.data): login_user(user, remember=form.remember_me.data) return redirect("/jobs") return render_template('login_form.html', message="Wrong login or password", form=form) return render_template('login_form.html', form=form)
def login(): form = LoginForm() if form.validate_on_submit(): session = db_session.create_session() user = session.query(Pupil).filter(Pupil.email == form.email.data).first() if user and user.check_password(form.email.data): login_user(user) jobs = session.query(Jobs).all() return render_template("jobs.html", a = True, b = False, jobs=jobs) #return redirect("/") return render_template('login.html', a = True, b = False, message="Такого почтового адреса не зарегистрировано", form=form) return render_template('login.html', a = True, b = False, title='Авторизация ученика', form=form)
def login(): if current_user.is_authenticated: return redirect(url_for('zapros')) form = LoginForm() if form.validate_on_submit(): session = db_session.create_session() user = session.query(User).filter(User.login == form.login.data).first() if user and user.check_password(form.password.data): login_user(user, remember=form.remember_me.data) return redirect(url_for('zapros')) return render_template('login.html', message="Неправильный логин или пароль", form=form) return render_template('login.html', title='Авторизация', form=form)
def login(): if current_user.is_authenticated: return redirect(url_for('index')) form = LoginForm() if form.validate_on_submit(): session = db_session.create_session() user = session.query(User).filter(User.email == form.email.data).first() if user and user.check_password(form.password.data): login_user(user, remember=form.remember_me.data) # next_page = request.args.get('next') # if not next_page or url_parse(next_page).netloc != '': # next_page = url_for('jobs_table') return redirect(url_for('jobs_table')) return render_template('login.html', message="Неправильный логин или пароль", form=form) return render_template('login.html', title='Авторизация', form=form)
def login_uchenik(): form = LoginForm() global role, name, klass role = 'Ученик' if form.validate_on_submit(): db_sess = db_session.create_session() user = db_sess.query(Student).filter(Student.login == form.username.data).first() password = db_sess.query(Student).filter(Student.hashed_password == form.password.data).first() if user and password: login_user(user) name = user.name klass = user.klass return redirect("/uchenik") return render_template('login.html', message="Неправильный логин или пароль", form=form, role='ученика') return render_template('login.html', title='Авторизация', form=form, role='ученика')
def login_uchitel(): global uchitel form = LoginForm() global role role = 'Учитель' if form.validate_on_submit(): db_sess = db_session.create_session() user = db_sess.query(Teacher).filter(Teacher.login == form.username.data).first() password = db_sess.query(Teacher).filter(Teacher.hashed_password == form.password.data).first() if user and password: uchitel = user login_user(user) return redirect("/uchitel") return render_template('login.html', message="Неправильный логин или пароль", form=form, role='учителя') return render_template('login.html', title='Авторизация', form=form, role='учителя')