diff --git a/epdb/views.py b/epdb/views.py index c956ef6e..50d88fa5 100644 --- a/epdb/views.py +++ b/epdb/views.py @@ -90,6 +90,7 @@ def login(request): if username != request.POST.get("username"): context["message"] = "Login failed!" return render(request, "static/login.html", context) + password = request.POST.get("password") # Get email for username and check if the account is active @@ -104,6 +105,7 @@ def login(request): except get_user_model().DoesNotExist: context["message"] = "Login failed!" return render(request, "static/login.html", context) + try: user = authenticate(username=email, password=password) except Exception: @@ -144,8 +146,10 @@ def register(request): # Redirect to unified login page with signup tab next_url = request.GET.get("next", "") redirect_url = reverse("login") + "#signup" + if next_url: redirect_url += f"?next={next_url}" + return redirect(redirect_url) elif request.method == "POST": context["title"] = "enviPath" @@ -159,18 +163,18 @@ def register(request): if not (username and email and password): context["message"] = "Invalid username/email/password" - return render(request, "static/register.html", context) + return render(request, "static/login.html", context) if password != rpassword or password == "": context["message"] = "Registration failed, provided passwords differ!" - return render(request, "static/register.html", context) + return render(request, "static/login.html", context) try: u = UserManager.create_user(username, email, password) logger.info(f"Created user {u.username} ({u.pk})") except Exception: context["message"] = "Registration failed! Couldn't create User Account." - return render(request, "static/register.html", context) + return render(request, "static/login.html", context) if s.ADMIN_APPROVAL_REQUIRED: context["success_message"] = ( diff --git a/templates/static/login.html b/templates/static/login.html index 20fee27f..e7525e96 100644 --- a/templates/static/login.html +++ b/templates/static/login.html @@ -3,174 +3,234 @@ {% block title %}enviPath - Sign In{% endblock %} {% block extra_styles %} -/* Tab styling */ -.tab-content { - display: none; -} - -.tab-content.active { - display: block; -} - -input[type="radio"].tab-radio { - display: none; -} - -.tab-label { - cursor: pointer; - padding: 0.75rem 1.5rem; - border-bottom: 2px solid transparent; - transition: all 0.3s ease; -} - -.tab-label:hover { - background-color: rgba(0, 0, 0, 0.05); -} - -input[type="radio"].tab-radio:checked + .tab-label { - border-bottom-color: #3b82f6; - font-weight: 600; -} + /* Tab styling */ .tab-content { display: none; } .tab-content.active { + display: block; } input[type="radio"].tab-radio { display: none; } .tab-label + { cursor: pointer; padding: 0.75rem 1.5rem; border-bottom: 2px solid + transparent; transition: all 0.3s ease; } .tab-label:hover { background-color: + rgba(0, 0, 0, 0.05); } input[type="radio"].tab-radio:checked + .tab-label { + border-bottom-color: #3b82f6; font-weight: 600; } {% endblock %} {% block content %} - -
+ +
- - + + - - + +
-
+
- -
+ +
- {% csrf_token %} - + {% csrf_token %} + -
- - -
+
+ + +
-
- - -
+
+ + +
- + - + - +
-
+
- -
+ +
- - - -
-
Password Requirements
-
- • 8 to 30 characters
- • Upper and lower case letters
- • Digits and special characters (_, -, +) -
+ + + +
+
Password Requirements
+
+ • 8 to 30 characters
+ • Upper and lower case letters
+ • Digits and special characters (_, -, +)
+
-
- {% csrf_token %} - + + {% csrf_token %} + -
- - -
+
+ + +
-
- - -
+
+ + +
-
- - -
+
+ + +
-
- - -
+
+ + +
- + - +
-

Why register?

-

enviPath is free for academic research and educational purposes. However, we require registration to ensure the security of the platform and to prevent abuse.

-

- Questions? Check our documentation or the community forums. +

Why register?

+

+ enviPath is free for academic research and educational purposes. + However, we require registration to ensure the security of the platform + and to prevent abuse. +

+

+ Questions? Check our + documentation + or the + community forums. +

-
+
{% endblock %} {% block extra_scripts %} - + {% endblock %}