[text]

Viewer

  1. @app.route('/login', methods=['POST', 'GET'])
  2. def login():
  3.     if request.method == "POST":    
  4.         x = request.json
  5.         email = x['email']
  6.         password = x['password']
  7.         print("email: "+email)
  8.         print("password: "+password)
  9.         if(check_user(email, password)):
  10.             print("tries to redirect")
  11.             print("--> return redirect(url_for('account'))")
  12.             return redirect(url_for('account'))
  13.             #return render_template("pages/accounts/account.html")
  14.         else:
  15.             print("Connection failed")
  16.             print("--> return redirect(url_for('home'))")
  17.             return redirect(url_for('home'))
  18.             #return redirect(url_for('home', title_message="Error", body_message="Incorrect username or password"))
  19.             #return render_template("pages/home.html", title_message="Error", body_message="Incorrect username or password")
  20.     return render_template("pages/accounts/login.html")
  21.  
  22. ''' in terminal:
  23.     -->
  24.     tries to redirect
  25. --> return redirect(url_for('account'))
  26. 127.0.0.1 - - [05/May/2021 21:46:00] "POST /login HTTP/1.1" 302 -
  27. 127.0.0.1 - - [05/May/2021 21:46:01] "GET /favicon.ico HTTP/1.1" 200 -
  28.  
  29. '''
  30.  

Editor

You can edit this paste and save as new:


File Description
  • Paste Code
  • 05 May-2021
  • 1.19 Kb
You can Share it: