コード例 #1
0
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)