aboutsummaryrefslogtreecommitdiff
path: root/app/auth
diff options
context:
space:
mode:
authorGertjan van den Burg <gertjanvandenburg@gmail.com>2019-05-30 13:29:31 +0100
committerGertjan van den Burg <gertjanvandenburg@gmail.com>2019-05-30 13:29:31 +0100
commitda15e439e64c8314825ad5f28073fbcbd436946f (patch)
tree62b40c9be838316fc1c0e1a5372d7bf8fbdc496b /app/auth
parentAdd database migration for cp_index (diff)
downloadAnnotateChange-da15e439e64c8314825ad5f28073fbcbd436946f.tar.gz
AnnotateChange-da15e439e64c8314825ad5f28073fbcbd436946f.zip
Initial version of demo
This commit introduces the demo functionality. The task assignment has been removed at the moment, as this will be changed in a future commit.
Diffstat (limited to 'app/auth')
-rw-r--r--app/auth/routes.py12
1 files changed, 2 insertions, 10 deletions
diff --git a/app/auth/routes.py b/app/auth/routes.py
index d23bc18..27b0de0 100644
--- a/app/auth/routes.py
+++ b/app/auth/routes.py
@@ -21,15 +21,10 @@ from app.auth.email import (
send_email_confirmation_email,
)
from app.models import User
-from app.utils.tasks import create_initial_user_tasks
@bp.route("/login", methods=("GET", "POST"))
def login():
- if current_user.is_authenticated:
- current_user.last_active = datetime.datetime.utcnow()
- db.session.commit()
- return redirect(url_for("main.index"))
form = LoginForm()
if form.validate_on_submit():
user = User.query.filter_by(username=form.username.data).first()
@@ -37,6 +32,8 @@ def login():
flash("Invalid username or password", "error")
return redirect(url_for("auth.login"))
login_user(user, remember=form.remember_me.data)
+ current_user.last_active = datetime.datetime.utcnow()
+ db.session.commit()
if not user.is_confirmed:
return redirect(url_for("auth.not_confirmed"))
next_page = request.args.get("next")
@@ -122,11 +119,6 @@ def confirm_email(token):
else:
user.is_confirmed = True
db.session.commit()
- for task in create_initial_user_tasks(user):
- if task is None:
- break
- db.session.add(task)
- db.session.commit()
flash("Account confirmed successfully. Thank you!", "success")
return redirect(url_for("auth.login"))
return redirect(url_for("main.index"))