def signin(): form = SigninForm() if form.validate_on_submit(): return redirect(url_for("dashboard")) if form.errors: flash("Username or password was incorrect") return render_template("signin.html", title="Sign In", form=form)
def signin(): form = SigninForm() if request.method == 'POST': if form.validate() == False: return render_template('signin.html', form=form) else: session['email'] = form.email.data return redirect(url_for('profile')) elif request.method == 'GET': return render_template('signin.html', form=form)
def signin(): if g.user is not None and g.user.is_authenticated: return redirect(url_for('home')) form = SigninForm() if form.validate_on_submit(): u = User.query.filter_by(username=form.username.data).first() if u is not None and u.verify_password(form.password.data): login_user(u, remember=form.remember_me.data) return redirect(url_for('home')) flash('Invalid username or password') return render_template('signin.html', form=form)
def signin(): login = SigninForm() register = RegisterForm() if ('user' in session): return redirect(url_for('user_profile')) if login.validate_on_submit(): # means that user is either judge or project member #TODO in login form session['user'] = login.finduser() return redirect(url_for('user_profile')) if register.validate_on_submit(): print("you have succesfully registered") session['user'] = register.getuser() flash('you have succesfully registered!') return redirect(url_for('user_profile')) #flash('Incorrect login details. Please try again or register for a new account.') #return redirect(url_for('new_user')) return render_template('signIn.html', register=register, login=login)
def signin(): form = SigninForm() if form.validate_on_submit(): if getSettings()['closed']: logging.warning( f"[APP] {form.studentID.data - 200000000} attempted to register but the Queue was closed." ) flash('Unfortunately, you were not added to the Queue.', 'warning') redirect(url_for('signin')) else: studentID = form.studentID.data - 200000000 if Student.query.filter_by(id=studentID).first() is None: logging.warning( f"[APP] {studentID} scanned their student ID card but no information found" ) flash( 'Student information not found, please talk to a Tutorials Teacher', 'danger') elif Queue.query.filter_by( studentID=studentID).first() is not None: logging.warning( f"[APP] {studentID} attempted to scan their student ID and enter the queue multiple times." ) flash( 'You can only sign into the Queue one subject at a time.', 'warning') else: logging.info( f"[APP] {studentID} added successfully to the queue.") db.session.add( Queue(timestamp=datetime.utcnow(), studentID=studentID, location='in-person')) db.session.commit() return redirect(url_for('signin')) return render_template('signin.html', form=form)