mirror of
https://github.com/TrentSPalmer/todo_app_flask.git
synced 2025-08-22 21:33:58 -07:00
Compare commits
4 Commits
7ba4063a84
...
master
Author | SHA1 | Date | |
---|---|---|---|
d781b1470c | |||
b81c6c9fa3 | |||
0dde8781ec | |||
4c5510b291 |
@@ -260,3 +260,5 @@
|
||||
"task_pkey" PRIMARY KEY, btree (id)<br />
|
||||
</p>
|
||||
|
||||
## Upgrading from Deb11 -> 12
|
||||
* install `python3-email-validator`
|
||||
|
@@ -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'],
|
||||
|
@@ -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):
|
||||
|
@@ -4,6 +4,8 @@ from flask import Blueprint, redirect, url_for, render_template
|
||||
from flask_login import current_user
|
||||
from app.models import Category, Task
|
||||
from markdown import markdown
|
||||
from time import timezone
|
||||
from datetime import timedelta
|
||||
|
||||
tsks = Blueprint(
|
||||
"tsks", __name__, template_folder="templates"
|
||||
@@ -25,7 +27,8 @@ def hidden_tasks(category_id):
|
||||
for task in tasks:
|
||||
task.markup = markdown(task.content)
|
||||
task.href = url_for('taskaction.task_action', taskid=task.id)
|
||||
task.time = task.timestamp.strftime("%Y-%m-%d %H:%M")
|
||||
local_time = task.timestamp - timedelta(seconds=timezone)
|
||||
task.time = local_time.strftime("%Y-%m-%d %H:%M")
|
||||
|
||||
nl = (
|
||||
('new', url_for('newtask.new_task', category_id=category_id)),
|
||||
@@ -56,7 +59,8 @@ def tasks(category_id):
|
||||
for task in tasks:
|
||||
task.markup = markdown(task.content)
|
||||
task.href = url_for('taskaction.task_action', taskid=task.id)
|
||||
task.time = task.timestamp.strftime("%Y-%m-%d %H:%M")
|
||||
local_time = task.timestamp - timedelta(seconds=timezone)
|
||||
task.time = local_time.strftime("%Y-%m-%d %H:%M")
|
||||
|
||||
nl = (
|
||||
('new', url_for('newtask.new_task', category_id=category_id)),
|
||||
|
Reference in New Issue
Block a user