mirror of
https://github.com/TrentSPalmer/todo_app_flask.git
synced 2025-08-22 21:33:58 -07:00
Compare commits
6 Commits
d406ff6508
...
master
Author | SHA1 | Date | |
---|---|---|---|
d781b1470c | |||
b81c6c9fa3 | |||
0dde8781ec | |||
4c5510b291 | |||
7ba4063a84 | |||
6f693c93dc |
4
.flaskenv.example
Normal file
4
.flaskenv.example
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# use this when developing locally with `flask run`
|
||||||
|
FLASK_APP=todo.py
|
||||||
|
FLASK_RUN_HOST="some_host_name"
|
||||||
|
FLASK_DEBUG="true"
|
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
.env
|
||||||
|
.flaskenv
|
||||||
|
__pycache__/
|
@@ -260,3 +260,5 @@
|
|||||||
"task_pkey" PRIMARY KEY, btree (id)<br />
|
"task_pkey" PRIMARY KEY, btree (id)<br />
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
## Upgrading from Deb11 -> 12
|
||||||
|
* install `python3-email-validator`
|
||||||
|
@@ -8,7 +8,7 @@ from io import BytesIO
|
|||||||
|
|
||||||
|
|
||||||
def get_totp_qr(contributor, app_config):
|
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:
|
if contributor.totp_key is None:
|
||||||
conn = psycopg2.connect(
|
conn = psycopg2.connect(
|
||||||
dbname=app_config['DATABASE_NAME'],
|
dbname=app_config['DATABASE_NAME'],
|
||||||
|
@@ -54,7 +54,11 @@ class Contributor(UserMixin, db.Model):
|
|||||||
return '<Contributor {}>'.format(self.name)
|
return '<Contributor {}>'.format(self.name)
|
||||||
|
|
||||||
def get_reset_password_token(self, expires_in=1800):
|
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
|
@staticmethod
|
||||||
def verify_reset_password_token(token):
|
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 flask_login import current_user
|
||||||
from app.models import Category, Task
|
from app.models import Category, Task
|
||||||
from markdown import markdown
|
from markdown import markdown
|
||||||
|
from time import timezone
|
||||||
|
from datetime import timedelta
|
||||||
|
|
||||||
tsks = Blueprint(
|
tsks = Blueprint(
|
||||||
"tsks", __name__, template_folder="templates"
|
"tsks", __name__, template_folder="templates"
|
||||||
@@ -25,7 +27,8 @@ def hidden_tasks(category_id):
|
|||||||
for task in tasks:
|
for task in tasks:
|
||||||
task.markup = markdown(task.content)
|
task.markup = markdown(task.content)
|
||||||
task.href = url_for('taskaction.task_action', taskid=task.id)
|
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 = (
|
nl = (
|
||||||
('new', url_for('newtask.new_task', category_id=category_id)),
|
('new', url_for('newtask.new_task', category_id=category_id)),
|
||||||
@@ -56,7 +59,8 @@ def tasks(category_id):
|
|||||||
for task in tasks:
|
for task in tasks:
|
||||||
task.markup = markdown(task.content)
|
task.markup = markdown(task.content)
|
||||||
task.href = url_for('taskaction.task_action', taskid=task.id)
|
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 = (
|
nl = (
|
||||||
('new', url_for('newtask.new_task', category_id=category_id)),
|
('new', url_for('newtask.new_task', category_id=category_id)),
|
||||||
|
Reference in New Issue
Block a user