diff --git a/apis/users_api.py b/apis/users_api.py index da5056f8..0cd6d2e5 100644 --- a/apis/users_api.py +++ b/apis/users_api.py @@ -161,8 +161,9 @@ def create_user(): cursor.execute(get_id_query) (id,) = cursor.fetchone() - - _send_confirmation_email(id, email, username, request.url_root, on_signup=True) + + if "MAIL_SERVER" in current_app.config: + _send_confirmation_email(id, email, username, request.url_root, on_signup=True) db.commit() diff --git a/frontend/templates/users/login.html b/frontend/templates/users/login.html index feb8148b..be01fe30 100644 --- a/frontend/templates/users/login.html +++ b/frontend/templates/users/login.html @@ -54,7 +54,11 @@ document.getElementById("loginForm").reset(); validationAlert("Successfully logged in!", false); - window.location.href = document.referrer || "/"; + if (!document.referrer || document.referrer.endsWith("/register")) + window.location.href = "/"; + else + window.location.href = document.referrer; + } else if (response.status == 401) { validationAlert("Invalid username or password"); } else { diff --git a/frontend/templates/users/register.html b/frontend/templates/users/register.html index 6caa42a9..0a4a17fb 100644 --- a/frontend/templates/users/register.html +++ b/frontend/templates/users/register.html @@ -52,8 +52,8 @@ document.getElementById("registerForm").reset(); validationAlert("Successfully Registered!", false); setTimeout(() => { - window.location.href = "/login"; - }, 2000); + window.location.replace("/login"); + }, 500); } else if (response.status == 409) { validationAlert("User already exists"); } else {