Compare commits

...

3 Commits

Author SHA1 Message Date
d781b1470c extend README 2025-06-18 15:46:50 -07:00
b81c6c9fa3 update totp.py handle pyotp.random_base32() now outputs 32 char string
that won't fit into existing 16char type in the existing app database
2025-06-18 15:07:47 -07:00
0dde8781ec update app/models.py handle jwt.encode now outputs string instead of bytes 2025-06-18 14:19:47 -07:00
3 changed files with 8 additions and 2 deletions

View File

@ -260,3 +260,5 @@
&nbsp;&nbsp;&nbsp;&nbsp;&quot;task_pkey&quot; PRIMARY KEY, btree (id)<br />
</p>
## Upgrading from Deb11 -> 12
* install `python3-email-validator`

View File

@ -8,7 +8,7 @@ from io import BytesIO
def get_totp_qr(contributor, app_config):
totp_key = pyotp.random_base32() if contributor.totp_key is None else contributor.totp_key
totp_key = pyotp.random_base32()[:16] if contributor.totp_key is None else contributor.totp_key
if contributor.totp_key is None:
conn = psycopg2.connect(
dbname=app_config['DATABASE_NAME'],

View File

@ -54,7 +54,11 @@ class Contributor(UserMixin, db.Model):
return '<Contributor {}>'.format(self.name)
def get_reset_password_token(self, expires_in=1800):
return jwt.encode({'reset_password': self.id, 'exp': time() + expires_in}, app.config['SECRET_KEY'], algorithm='HS256').decode('utf-8')
token = jwt.encode({'reset_password': self.id, 'exp': time() + expires_in}, app.config['SECRET_KEY'], algorithm='HS256')
if type(token) == str:
return token
else:
return token.decode('utf-8')
@staticmethod
def verify_reset_password_token(token):