Advertisement
Guest User

Untitled

a guest
Jun 27th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. class User2(UserMixin,db.Model):
  2. id = db.Column(db.Integer, primary_key=True)
  3. username = db.Column(db.String(80), unique=False, nullable=False)
  4. password_hash = db.Column(db.String(30), unique=False, nullable=False)
  5. @property
  6. def password(self):
  7. raise AttributeError('password is not a readable attribute')
  8. @password.setter
  9. def password(self, password):
  10. self.password_hash = generate_password_hash(password)
  11. def verify_password(self, password):
  12. return check_password_hash(self.password_hash, password)
  13.  
  14.  
  15. p = request.form.get("password")
  16. if t is not None and User2.verify_password(p):
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement