daily pastebin goal
1%
SHARE
TWEET

Untitled

a guest Mar 17th, 2018 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. File "D:GamesPythonlibsite-packagesflaskapp.py", line 1997, in __call__
  2. return self.wsgi_app(environ, start_response)
  3. File "D:GamesPythonlibsite-packagesflaskapp.py", line 1985, in wsgi_app
  4. response = self.handle_exception(e)
  5. File "D:GamesPythonlibsite-packagesflaskapp.py", line 1540, in handle_exception
  6. reraise(exc_type, exc_value, tb)
  7. File "D:GamesPythonlibsite-packagesflask_compat.py", line 33, in reraise
  8. raise value
  9. File "D:GamesPythonlibsite-packagesflaskapp.py", line 1982, in wsgi_app
  10. response = self.full_dispatch_request()
  11. File "D:GamesPythonlibsite-packagesflaskapp.py", line 1614, in full_dispatch_request
  12. rv = self.handle_user_exception(e)
  13. File "D:GamesPythonlibsite-packagesflaskapp.py", line 1517, in handle_user_exception
  14. reraise(exc_type, exc_value, tb)
  15. File "D:GamesPythonlibsite-packagesflask_compat.py", line 33, in reraise
  16. raise value
  17. File "D:GamesPythonlibsite-packagesflaskapp.py", line 1612, in full_dispatch_request
  18. rv = self.dispatch_request()
  19. File "D:GamesPythonlibsite-packagesflaskapp.py", line 1598, in dispatch_request
  20. return self.view_functions[rule.endpoint](**req.view_args)
  21. File "d:gamespythonprojrun.py", line 129, in log
  22. login_user(user)
  23. File "D:GamesPythonlibsite-packagesflask_loginutils.py", line 158, in login_user
  24. if not force and not user.is_active:
  25. AttributeError: 'NoneType' object has no attribute 'is_active'
  26.    
  27. @app.route('/log', methods=['GET', 'POST'])
  28. def log():
  29.     if current_user.is_authenticated:
  30.         return redirect(url_for('/'))
  31.     form=Form(request.form)
  32.     if request.method == 'POST' and form.validate():
  33.         femail = request.form['email']
  34.         password=request.form['password']
  35.         user = User.query.filter_by(email=femail).first()
  36.         if user is None or not user.check_password(password):
  37.             flash('Invalid username or password.')
  38.         login_user(user)
  39.         return redirect(url_for('button'))
  40.     return render_template('login.html', form=form)
  41.    
  42. class User(db.Model,UserMixin):
  43.     __tablename__="user"
  44.     id = db.Column(db.Integer, primary_key=True)
  45.     email = db.Column(db.String(255), unique=True)
  46.     password = db.Column(db.String(255))
  47.     confirmed_at = db.Column(db.DateTime())
  48.     roles = db.relationship(
  49.         'Role',
  50.         secondary=roles_users,
  51.         backref=db.backref('user', lazy='dynamic')
  52.     )
  53.     posts = db.relationship('Post', backref='author', lazy='dynamic')
  54.  
  55.  
  56.     def set_password(self, password):
  57.         self.password_hash = generate_password_hash(password)
  58.  
  59.     def check_password(self, password):
  60.         return check_password_hash(self.password_hash, password)
  61.  
  62.     def is_authenticated(self):
  63.         return True
  64.    
  65. <form  action="" method="post" role="form">
  66. {{ form.csrf }}
  67.     <div class="login">
  68.         <div class="login-screen">
  69.             <div class="app-title">
  70.                 <h1>Login</h1>
  71.             </div>
  72.             <div class="login-form">
  73.                 <div class="control-group">
  74.                 <input type="text" class="login-field" value="" placeholder="email" name="email">
  75.                 <label class="login-field-icon fui-user" for="login-name"></label>
  76.                 </div>
  77.  
  78.                 <div class="control-group">
  79.                 <input type="password" class="login-field" value="" placeholder="password" name="password">
  80.                 <label class="login-field-icon fui-lock" for="login-pass"></label>
  81.                 </div>
  82.  
  83.                 <input type="submit" value="Log in" class="btn btn-primary btn-large btn-block" >
  84.                 <br>
  85.             </div>
  86.         </div>
  87.     </div>
  88. </form>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top