Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- File "D:GamesPythonlibsite-packagesflaskapp.py", line 1997, in __call__
- return self.wsgi_app(environ, start_response)
- File "D:GamesPythonlibsite-packagesflaskapp.py", line 1985, in wsgi_app
- response = self.handle_exception(e)
- File "D:GamesPythonlibsite-packagesflaskapp.py", line 1540, in handle_exception
- reraise(exc_type, exc_value, tb)
- File "D:GamesPythonlibsite-packagesflask_compat.py", line 33, in reraise
- raise value
- File "D:GamesPythonlibsite-packagesflaskapp.py", line 1982, in wsgi_app
- response = self.full_dispatch_request()
- File "D:GamesPythonlibsite-packagesflaskapp.py", line 1614, in full_dispatch_request
- rv = self.handle_user_exception(e)
- File "D:GamesPythonlibsite-packagesflaskapp.py", line 1517, in handle_user_exception
- reraise(exc_type, exc_value, tb)
- File "D:GamesPythonlibsite-packagesflask_compat.py", line 33, in reraise
- raise value
- File "D:GamesPythonlibsite-packagesflaskapp.py", line 1612, in full_dispatch_request
- rv = self.dispatch_request()
- File "D:GamesPythonlibsite-packagesflaskapp.py", line 1598, in dispatch_request
- return self.view_functions[rule.endpoint](**req.view_args)
- File "d:gamespythonprojrun.py", line 129, in log
- login_user(user)
- File "D:GamesPythonlibsite-packagesflask_loginutils.py", line 158, in login_user
- if not force and not user.is_active:
- AttributeError: 'NoneType' object has no attribute 'is_active'
- @app.route('/log', methods=['GET', 'POST'])
- def log():
- if current_user.is_authenticated:
- return redirect(url_for('/'))
- form=Form(request.form)
- if request.method == 'POST' and form.validate():
- femail = request.form['email']
- password=request.form['password']
- user = User.query.filter_by(email=femail).first()
- if user is None or not user.check_password(password):
- flash('Invalid username or password.')
- login_user(user)
- return redirect(url_for('button'))
- return render_template('login.html', form=form)
- class User(db.Model,UserMixin):
- __tablename__="user"
- id = db.Column(db.Integer, primary_key=True)
- email = db.Column(db.String(255), unique=True)
- password = db.Column(db.String(255))
- confirmed_at = db.Column(db.DateTime())
- roles = db.relationship(
- 'Role',
- secondary=roles_users,
- backref=db.backref('user', lazy='dynamic')
- )
- posts = db.relationship('Post', backref='author', lazy='dynamic')
- def set_password(self, password):
- self.password_hash = generate_password_hash(password)
- def check_password(self, password):
- return check_password_hash(self.password_hash, password)
- def is_authenticated(self):
- return True
- <form action="" method="post" role="form">
- {{ form.csrf }}
- <div class="login">
- <div class="login-screen">
- <div class="app-title">
- <h1>Login</h1>
- </div>
- <div class="login-form">
- <div class="control-group">
- <input type="text" class="login-field" value="" placeholder="email" name="email">
- <label class="login-field-icon fui-user" for="login-name"></label>
- </div>
- <div class="control-group">
- <input type="password" class="login-field" value="" placeholder="password" name="password">
- <label class="login-field-icon fui-lock" for="login-pass"></label>
- </div>
- <input type="submit" value="Log in" class="btn btn-primary btn-large btn-block" >
- <br>
- </div>
- </div>
- </div>
- </form>
Add Comment
Please, Sign In to add comment