Reputation: 1
I'm having trouble implementing hash/check_hash functions in flask with rethinkDB (using remodel ORM). What I have coded I know can't work, but I'm not sure how to implement this, so that it will work. Should I just hash/check hash the password when the user is logging in/registering or is there another way?
from remodel.models import Model
from passlib.hash import pbkdf2_sha256
from flask_login import UserMixin
class User(UserMixin, Model):
has_many = ('Post',)
def set_password(self, password):
self.password_hash = pbkdf2_sha256.hash(password)
def check_password(self, password):
return pbkdf2_sha256.verify(password, self.password_hash)
p.s.: I know sha256 is not good for storing passwords but this project is just so I can learn how to use rethinkdb with Flask
Upvotes: 0
Views: 127