summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/tutorials/wiki2/src/authentication/tutorial/models/user.py5
-rw-r--r--docs/tutorials/wiki2/src/authorization/tutorial/models/user.py5
-rw-r--r--docs/tutorials/wiki2/src/models/tutorial/models/user.py5
-rw-r--r--docs/tutorials/wiki2/src/tests/tutorial/models/user.py5
-rw-r--r--docs/tutorials/wiki2/src/views/tutorial/models/user.py5
5 files changed, 10 insertions, 15 deletions
diff --git a/docs/tutorials/wiki2/src/authentication/tutorial/models/user.py b/docs/tutorials/wiki2/src/authentication/tutorial/models/user.py
index 6fb32a1b2..9228b48f7 100644
--- a/docs/tutorials/wiki2/src/authentication/tutorial/models/user.py
+++ b/docs/tutorials/wiki2/src/authentication/tutorial/models/user.py
@@ -19,11 +19,10 @@ class User(Base):
def set_password(self, pw):
pwhash = bcrypt.hashpw(pw.encode('utf8'), bcrypt.gensalt())
- self.password_hash = pwhash
+ self.password_hash = pwhash.decode('utf8')
def check_password(self, pw):
if self.password_hash is not None:
expected_hash = self.password_hash.encode('utf8')
- actual_hash = bcrypt.hashpw(pw.encode('utf8'), expected_hash)
- return expected_hash == actual_hash
+ return bcrypt.checkpw(pw.encode('utf8'), expected_hash)
return False
diff --git a/docs/tutorials/wiki2/src/authorization/tutorial/models/user.py b/docs/tutorials/wiki2/src/authorization/tutorial/models/user.py
index 6fb32a1b2..9228b48f7 100644
--- a/docs/tutorials/wiki2/src/authorization/tutorial/models/user.py
+++ b/docs/tutorials/wiki2/src/authorization/tutorial/models/user.py
@@ -19,11 +19,10 @@ class User(Base):
def set_password(self, pw):
pwhash = bcrypt.hashpw(pw.encode('utf8'), bcrypt.gensalt())
- self.password_hash = pwhash
+ self.password_hash = pwhash.decode('utf8')
def check_password(self, pw):
if self.password_hash is not None:
expected_hash = self.password_hash.encode('utf8')
- actual_hash = bcrypt.hashpw(pw.encode('utf8'), expected_hash)
- return expected_hash == actual_hash
+ return bcrypt.checkpw(pw.encode('utf8'), expected_hash)
return False
diff --git a/docs/tutorials/wiki2/src/models/tutorial/models/user.py b/docs/tutorials/wiki2/src/models/tutorial/models/user.py
index 6fb32a1b2..9228b48f7 100644
--- a/docs/tutorials/wiki2/src/models/tutorial/models/user.py
+++ b/docs/tutorials/wiki2/src/models/tutorial/models/user.py
@@ -19,11 +19,10 @@ class User(Base):
def set_password(self, pw):
pwhash = bcrypt.hashpw(pw.encode('utf8'), bcrypt.gensalt())
- self.password_hash = pwhash
+ self.password_hash = pwhash.decode('utf8')
def check_password(self, pw):
if self.password_hash is not None:
expected_hash = self.password_hash.encode('utf8')
- actual_hash = bcrypt.hashpw(pw.encode('utf8'), expected_hash)
- return expected_hash == actual_hash
+ return bcrypt.checkpw(pw.encode('utf8'), expected_hash)
return False
diff --git a/docs/tutorials/wiki2/src/tests/tutorial/models/user.py b/docs/tutorials/wiki2/src/tests/tutorial/models/user.py
index 6fb32a1b2..9228b48f7 100644
--- a/docs/tutorials/wiki2/src/tests/tutorial/models/user.py
+++ b/docs/tutorials/wiki2/src/tests/tutorial/models/user.py
@@ -19,11 +19,10 @@ class User(Base):
def set_password(self, pw):
pwhash = bcrypt.hashpw(pw.encode('utf8'), bcrypt.gensalt())
- self.password_hash = pwhash
+ self.password_hash = pwhash.decode('utf8')
def check_password(self, pw):
if self.password_hash is not None:
expected_hash = self.password_hash.encode('utf8')
- actual_hash = bcrypt.hashpw(pw.encode('utf8'), expected_hash)
- return expected_hash == actual_hash
+ return bcrypt.checkpw(pw.encode('utf8'), expected_hash)
return False
diff --git a/docs/tutorials/wiki2/src/views/tutorial/models/user.py b/docs/tutorials/wiki2/src/views/tutorial/models/user.py
index 6fb32a1b2..9228b48f7 100644
--- a/docs/tutorials/wiki2/src/views/tutorial/models/user.py
+++ b/docs/tutorials/wiki2/src/views/tutorial/models/user.py
@@ -19,11 +19,10 @@ class User(Base):
def set_password(self, pw):
pwhash = bcrypt.hashpw(pw.encode('utf8'), bcrypt.gensalt())
- self.password_hash = pwhash
+ self.password_hash = pwhash.decode('utf8')
def check_password(self, pw):
if self.password_hash is not None:
expected_hash = self.password_hash.encode('utf8')
- actual_hash = bcrypt.hashpw(pw.encode('utf8'), expected_hash)
- return expected_hash == actual_hash
+ return bcrypt.checkpw(pw.encode('utf8'), expected_hash)
return False