Guest User

Untitled

a guest
Feb 16th, 2019
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. @app.route('/login', methods=['GET', 'POST'])
  2. def login():
  3. form = LoginForm()
  4. name=form.name.data
  5.  
  6. if form.validate_on_submit():
  7. user = User.query.filter_by(username=form.username.data).first()
  8. if user:
  9. if user.password == form.password.data:
  10. login_user(user, remember=form.remember.data)
  11. session['logged_in'] = True
  12. return redirect(url_for('dashboard', name=name))
  13.  
  14. return '<h1>Invalid username or password</h1>'
  15. #return '<h1>' + form.username.data + ' ' + form.password.data + '</h1>'
  16.  
  17. return render_template('login.html', form=form)
  18.  
  19. @app.route('/dashboard', methods=['GET', 'POST'])
  20. @login_required
  21. def dashboard():
  22. name=request.args.get('name')
  23. return render_template('dashboard.html',name=name)
  24.  
  25. <section id="home" style="background: url('../static/images/rate25.jpg');background-attachment: fixed;background-size: cover;background-repeat: no-repeat;background-position: center;">
  26. <div class="container-fluid con" align="center">
  27. <div class="row" align="center">
  28. <div class="col-sm-2"></div>
  29. <div class="col-sm-8">
  30. <h1 class="h1" style="font-weight: 500;text-transform: unset;">Hi {{name}}, Welcome to Ratingspro</h1></div>
  31. <div class="col-sm-2"></div>
  32.  
  33. </div>
  34. </div>
  35. </section>
Add Comment
Please, Sign In to add comment