Beispiel #1
0
def signinauthenticate():

    #grab the request data
    try:
      #or use a email parsing library, you get the idea and do something...
      inputEmailAddress = request.form.get("inputEmailAddress")
      if not re.match(r"[^@]+@[^@]+\.[^@]+", inputEmailAddress):
      if not re.match(r"^[A-Za-z0-9\.\+_-]+@[A-Za-z0-9\._-]+\.[a-zA-Z]*$", inputEmailAddress):

      inputPassword = request.form.get("inputPassword")

      #Query NoSQL and find out if this member already exists by email, if so, show the error
      member = MemberInfo()
      member = member.getMemberInfoByEmail(inputEmailAddress)

      #Make sure the password is correct
      if not check_password_hash(member.passwordhash, inputPassword):
        return render_template('index.html', inputEmailAddress=inputEmailAddress, alertmessage='It appears that is not quite right.')
      
      #Save the session and cookie values (do more than just email, but again, you get the idea)
      session[_SESSION_COOKIE_EMAIL] = member.emailaddress

      return redirect(url_for('landingpage'))
      
    except:
      return render_template('index.html', inputEmailAddress='', alertmessage='Oops!')