Commit d8ab8257 authored by Giorgos Kazelidis's avatar Giorgos Kazelidis

- Created the session continuation template and modified the...

- Created the session continuation template and modified the display_default_login_page() view to display the former when it is accessed by (logged-in) instances of the application user models (usermerge.{User/Admin})
- Modified the log_in() view to deny access to (logged-in) instances of the application user models (usermerge.{User/Admin})
- Modified the display_default_login_page(), log_in() and log_out() views to deny access to (logged-in) instances of Django's default user model (auth.User)
- Defined the has_empty_profile() method for the usermerge.User model and used it in templates and views to enhance functionality and readability
- Omitted the redundant user_id parameters/arguments from (i) the application site URLs defined in the URLconf and used in templates/views and (ii) the corresponding view declarations (the current/session user can be specified in any view via the user attribute of the associated request)
- Utilized the recov_user_id value of the session data in the _display_user_profile_recovery_success_message() and _display_user_profile_recovery_error_messages() helper functions as well as the search_for_recovery_user_profile() and recover_user_profile() views to enhance functionality and security
- Hooked the Django admin site into the /django-admin/ URL (instead of the default one, /admin/) to distinguish its pages from the ones that refer to the usermerge.Admin model and have an /admin/ URL prefix
parent 95a43695
...@@ -18,6 +18,6 @@ from django.contrib import admin ...@@ -18,6 +18,6 @@ from django.contrib import admin
from django.urls import include, path from django.urls import include, path
urlpatterns = [ urlpatterns = [
path('admin/', admin.site.urls), path('django-admin/', admin.site.urls), # (Django) admin site URLs
path('', include('usermerge.urls')), path('', include('usermerge.urls')), # usermerge (application) site URLs
] ]
""" """
Modified version of django.contrib.auth module (https://docs.djangoproject.com/en/2.0/_modules/django/contrib/auth/). Modified version of django.contrib.auth module (https://docs.djangoproject.com/en/2.0/_modules/django/contrib/auth/)
that refers to authentication against the application user models, i.e. usermerge.User and usermerge.Admin models.
""" """
from django.apps import apps as django_apps from django.apps import apps as django_apps
...@@ -63,8 +64,8 @@ def login(request, user, backend = None): ...@@ -63,8 +64,8 @@ def login(request, user, backend = None):
# Calculate the session authentication hash for the authenticated user that attempts to log in based on the platform selected in the # Calculate the session authentication hash for the authenticated user that attempts to log in based on the platform selected in the
# login form. The selected platform is representative of the user model (if the selected platform was SLUB, the user model is Admin, # login form. The selected platform is representative of the user model (if the selected platform was SLUB, the user model is Admin,
# otherwise it is User) and the calculation of the hash differs between the user models (see the different get_session_auth_hash() # otherwise it is User) and the calculation of the hash differs between the user models (see the different get_session_auth_hash()
# methods in models.py). If the user logs in successfully, the hash is stored in the session data and can then be used to verify the # methods in models.py). If the user logs in successfully, the hash is stored in the session data as the HASH_SESSION_KEY value and
# user's authenticity during the session (see, for example, the get_user() function below). # can then be used to verify the user's authenticity during the session (see, for example, the get_user() function below).
if platform_name == 'SLUB': if platform_name == 'SLUB':
# Admin hash calculation # Admin hash calculation
session_auth_hash = user.get_session_auth_hash() session_auth_hash = user.get_session_auth_hash()
...@@ -93,7 +94,7 @@ def login(request, user, backend = None): ...@@ -93,7 +94,7 @@ def login(request, user, backend = None):
'provide the "backend" argument or set the "backend" attribute on the user.') 'provide the "backend" argument or set the "backend" attribute on the user.')
request.session[SESSION_KEY] = user._meta.pk.value_to_string(user) request.session[SESSION_KEY] = user._meta.pk.value_to_string(user)
# The platform (name) selected in the login form is stored in the session data. # The platform (name) selected in the login form is stored in the session data as the PLATFORM_SESSION_KEY value.
request.session[PLATFORM_SESSION_KEY] = platform_name request.session[PLATFORM_SESSION_KEY] = platform_name
request.session[BACKEND_SESSION_KEY] = backend request.session[BACKEND_SESSION_KEY] = backend
request.session[HASH_SESSION_KEY] = session_auth_hash request.session[HASH_SESSION_KEY] = session_auth_hash
......
...@@ -17,7 +17,7 @@ def User_login_required(view): ...@@ -17,7 +17,7 @@ def User_login_required(view):
def User_model_required(func): def User_model_required(func):
@wraps(func) @wraps(func)
def wrapper(request, *args, **kwargs): def wrapper(request, *args, **kwargs):
if str(request.user.__class__) == "<class 'usermerge.models.User'>": if request.user._meta.label == 'usermerge.User':
return func(request, *args, **kwargs) return func(request, *args, **kwargs)
else: # either auth.User or usermerge.Admin model else: # either auth.User or usermerge.Admin model
raise PermissionDenied raise PermissionDenied
...@@ -34,7 +34,7 @@ def Admin_login_required(view): ...@@ -34,7 +34,7 @@ def Admin_login_required(view):
def Admin_model_required(func): def Admin_model_required(func):
@wraps(func) @wraps(func)
def wrapper(request, *args, **kwargs): def wrapper(request, *args, **kwargs):
if str(request.user.__class__) == "<class 'usermerge.models.Admin'>": if request.user._meta.label == 'usermerge.Admin':
return func(request, *args, **kwargs) return func(request, *args, **kwargs)
else: # either auth.User or usermerge.User model else: # either auth.User or usermerge.User model
raise PermissionDenied raise PermissionDenied
......
...@@ -85,12 +85,13 @@ def _display_user_profile_recovery_success_message(request, recov_user): ...@@ -85,12 +85,13 @@ def _display_user_profile_recovery_success_message(request, recov_user):
""" """
[Acts as inner function of the search_for_recovery_user_profile() view] Display the appropriate success message in the user profile [Acts as inner function of the search_for_recovery_user_profile() view] Display the appropriate success message in the user profile
recovery page by taking the recovery user profile (non-empty User instance that corresponds to both the validated - cleaned - and recovery page by taking the recovery user profile (non-empty User instance that corresponds to both the validated - cleaned - and
adequate ece_id and email values of the corresponding form) into account. This message presents the (empty) session user with all the adequate ece_id and email values of the corresponding form) into account. This message presents the (empty) session user with all
field values of the aforementioned profile and informs him/her that if he/she proceeds with the profile recovery, he/she will get the field values of the aforementioned profile and informs him/her that if he/she proceeds with the profile recovery, he/she will
logged out after his/her credentials for the login platform have first been associated with this profile (they will replace any get logged out after his/her credentials for the login platform have first been associated with this profile (they will replace any
previously associated ones). Finally, include the recovery profile in the page context to assist the recovery procedure - see the previously associated ones). Finally, enable the recovery procedure - see the recover_user_profile() view - by storing the id of
recover_user_profile() view. the recovery user profile in the session data as the recov_user_id value (it replaces any previously stored one).
""" """
request.session['recov_user_id'] = recov_user.id
success_message = ('Τα δηλωθέντα στοιχεία εντοπίστηκαν επιτυχώς στη βάση και παραπέμπουν στο εξής καταχωρημένο προφίλ:\n\n' success_message = ('Τα δηλωθέντα στοιχεία εντοπίστηκαν επιτυχώς στη βάση και παραπέμπουν στο εξής καταχωρημένο προφίλ:\n\n'
'Όνομα: %s\n' 'Όνομα: %s\n'
'Επώνυμο: %s\n' 'Επώνυμο: %s\n'
...@@ -102,14 +103,19 @@ def _display_user_profile_recovery_success_message(request, recov_user): ...@@ -102,14 +103,19 @@ def _display_user_profile_recovery_success_message(request, recov_user):
) % (recov_user.first_name, recov_user.last_name, ) % (recov_user.first_name, recov_user.last_name,
'[Δεν έχει καταχωρηθεί]' if recov_user.ece_id is None else recov_user.ece_id, '[Δεν έχει καταχωρηθεί]' if recov_user.ece_id is None else recov_user.ece_id,
recov_user.email, request.session[PLATFORM_SESSION_KEY]) recov_user.email, request.session[PLATFORM_SESSION_KEY])
return TemplateResponse(request, 'user_profile_recovery.html', {'success_message': success_message, 'recov_user': recov_user}) return TemplateResponse(request, 'user_profile_recovery.html', {'success_message': success_message})
def _display_user_profile_recovery_error_messages(request, error_data): def _display_user_profile_recovery_error_messages(request, error_data):
""" """
[Acts as inner function of the search_for_recovery_user_profile() view] Create the appropriate post-validation error messages [Acts as inner function of the search_for_recovery_user_profile() view] Create the appropriate post-validation error messages
by using the validated (cleaned), yet inadequate, ece_id or/and email values of the user profile recovery form along with the by using the validated (cleaned), yet inadequate, ece_id or/and email values of the user profile recovery form along with the
corresponding error codes, display them in the user profile recovery page and include the error codes in the page context. corresponding error codes, display them in the user profile recovery page and include the error codes in the page context. Since
no recovery user profile (non-empty User instance that corresponds to both of the aforementioned form values) has been specified
in usermergeDB, disable the recovery procedure - see the recover_user_profile() view - by ensuring that the recov_user_id value
does not exist in the session data (if it exists, delete it).
""" """
if 'recov_user_id' in request.session:
del request.session['recov_user_id']
error_messages = [] error_messages = []
error_codes = [] error_codes = []
# The ece_id_and_email_exist_in_different_profiles error can only occur by itself. This means that if it occurs, # The ece_id_and_email_exist_in_different_profiles error can only occur by itself. This means that if it occurs,
......
...@@ -9,7 +9,7 @@ from . import auth as usermerge_auth ...@@ -9,7 +9,7 @@ from . import auth as usermerge_auth
# AuthenticationMiddleware is a middleware component that associates the current user with every incoming web request. Original source code for the get_user() function and the aforementioned component can be found in https://github.com/django/django/blob/master/django/contrib/auth/middleware.py (for more information, see https://docs.djangoproject.com/en/2.0/ref/middleware/#django.contrib.auth.middleware.AuthenticationMiddleware). # AuthenticationMiddleware is a middleware component that associates the current user with every incoming web request. Original source code for the get_user() function and the aforementioned component can be found in https://github.com/django/django/blob/master/django/contrib/auth/middleware.py (for more information, see https://docs.djangoproject.com/en/2.0/ref/middleware/#django.contrib.auth.middleware.AuthenticationMiddleware).
# For more information on default/customizing user authentication and password management, see https://docs.djangoproject.com/en/2.0/topics/auth/, auth.py and backends.py . # For more information on default/customizing user authentication and password management, see https://docs.djangoproject.com/en/2.0/topics/auth/, auth.py and backends.py .
# The login() function of the application's authentication module (usermerge.auth) is used to log a user (usermerge.{User/Admin} instance) in via the login page of the application - see the log_in() view - and inserts the PLATFORM_SESSION_KEY value into the (dictionary-like) session data based on the platform selected in the corresponding form. On the other hand, the login() function of the default authentication module (django.contrib.auth) is used to log a user (auth.User instance) in via the login page of the admin site (see https://docs.djangoproject.com/en/2.0/ref/contrib/admin/) and does not insert any PLATFORM_SESSION_KEY value into the session data as the corresponding form does not include any platform field. # The login() function of the application's authentication module (usermerge.auth) is used to log a user (usermerge.{User/Admin} instance) in via the login page of the application - see the log_in() view - and stores the PLATFORM_SESSION_KEY value in the session data based on the platform (name) selected in the corresponding form. On the other hand, the login() function of the default authentication module (django.contrib.auth) is used to log a user (auth.User instance) in via the login page of the admin site (see https://docs.djangoproject.com/en/2.0/ref/contrib/admin/) and does not store any PLATFORM_SESSION_KEY value in the session data as the corresponding form does not include any platform field.
def get_user(request): def get_user(request):
if not hasattr(request, '_cached_user'): if not hasattr(request, '_cached_user'):
......
...@@ -34,11 +34,20 @@ class User(models.Model): ...@@ -34,11 +34,20 @@ class User(models.Model):
@property @property
def is_authenticated(self): def is_authenticated(self):
""" """
Always return True. This is a way to tell if the user has been Always return True. This is a way to tell if the user has been authenticated in templates, views, etc.
authenticated in templates, views, etc.
""" """
return True return True
def has_empty_profile(self):
"""
Return the opposite boolean value of the email field, i.e. True if the email is None and False otherwise. This is a way to tell
whether the user has an empty profile in templates, views, etc. as the user profile is empty if the email is None and vice versa.
"""
# The email value can be used to determine whether the user profile (User instance) is empty or not due to the latter's
# possible/valid (field) states in usermergeDB and the allowed/consistent transitions between them (see the relative
# comment at the top).
return not bool(self.email)
class Platform(models.Model): class Platform(models.Model):
name = models.CharField(max_length = 50, unique = True) name = models.CharField(max_length = 50, unique = True)
...@@ -84,8 +93,7 @@ class Admin(models.Model): ...@@ -84,8 +93,7 @@ class Admin(models.Model):
@property @property
def is_authenticated(self): def is_authenticated(self):
""" """
Always return True. This is a way to tell if the user has been Always return True. This is a way to tell whether the user has been authenticated in templates, views, etc.
authenticated in templates, views, etc.
""" """
return True return True
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
{% block content %} {% block content %}
<nav id="session_nav"> <nav id="session_nav">
Έχετε εισέλθει ως <strong>{{ user.first_name }} {{ user.last_name }}</strong>! Έχετε εισέλθει ως <strong>{{ user.first_name }} {{ user.last_name }}</strong>!
| <a href="{% url 'admin_home' user.id %}">Αρχική Σελίδα</a> | <a href="{% url 'admin_home' %}">Αρχική Σελίδα</a>
| <a href="{% url 'logout' %}">Έξοδος</a> | <a href="{% url 'logout' %}">Έξοδος</a>
</nav> </nav>
......
{# This page/template is utilized in the display_default_login_page() view. #}
{% extends 'base.html' %}
{% block title %}
SLUB - Συνέχιση Συνεδρίας ή Έξοδος
{% endblock %}
{% block content %}
<nav id="session_nav">
{% if user.first_name and user.last_name %}
Έχετε εισέλθει ως <strong>{{ user.first_name }} {{ user.last_name }}</strong>!
{% else %}
Έχετε εισέλθει επιτυχώς!
{% endif %}
| <a href="{% url home_page_url %}">Αρχική Σελίδα</a>
| <a href="{% url 'logout' %}">Έξοδος</a>
</nav>
<h4>Συνέχιση Συνεδρίας ή Έξοδος</h4>
<p>
<strong>
Υπάρχει ήδη μία συνεδρία σε ισχύ! Θα θέλατε να <a href="{% url home_page_url %}">συνεχίσετε</a> την πλοήγηση σε αυτήν <br />
ή να <a href="{% url 'logout' %}">εξέλθετε</a> για να ξεκινήσετε μία νέα συνεδρία ως διαφορετικός χρήστης;
</strong>
</p>
{% endblock %}
...@@ -5,44 +5,46 @@ ...@@ -5,44 +5,46 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<nav id="session_nav"> {% with empty_user_profile=user.has_empty_profile %}
{% if user.first_name and user.last_name %} <nav id="session_nav">
Έχετε εισέλθει ως <strong>{{ user.first_name }} {{ user.last_name }}</strong>! {% if not empty_user_profile %}
{% else %} Έχετε εισέλθει ως <strong>{{ user.first_name }} {{ user.last_name }}</strong>!
Έχετε εισέλθει επιτυχώς! {% else %}
{% endif %} Έχετε εισέλθει επιτυχώς!
| <a href="{% url 'user_home' user.id %}">Αρχική Σελίδα</a> {% endif %}
| <a href="{% url 'logout' %}">Έξοδος</a> | <a href="{% url 'user_home' %}">Αρχική Σελίδα</a>
</nav> | <a href="{% url 'logout' %}">Έξοδος</a>
</nav>
<h4>Αρχική Σελίδα Χρήστη</h4>
{% if user.ece_id is None %} <h4>Αρχική Σελίδα Χρήστη</h4>
<p>
<strong>
{% if user.first_name == '' and user.last_name == '' and user.email is None %}
&#x272A; Παρακαλούμε συμπληρώστε άμεσα τα στοιχεία του προφίλ σας επιλέγοντας "Επεξεργασία Προφίλ"!
{% else %}
&#x272A; Αν διαθέτετε αριθμό μητρώου, παρακαλούμε συμπληρώστε άμεσα το <br />
αντίστοιχο πεδίο του προφίλ επιλέγοντας "Επεξεργασία Προφίλ"!
{% endif %}
</strong>
</p>
{% endif %}
<nav id="home_nav"> {% if user.ece_id is None %}
{% comment %} <p>
The "Edit Profile" and "Log out" options are ALWAYS available to the user. ALL the OTHER <strong>
navigation options are available to him/her ONLY if his/her profile is NON-empty. {% if empty_user_profile %}
{% endcomment %} &#x272A; Παρακαλούμε συμπληρώστε άμεσα τα στοιχεία του προφίλ σας επιλέγοντας "Επεξεργασία Προφίλ"!
<p><a href="{% url 'default_user_profile_edit' user.id %}">Επεξεργασία Προφίλ</a></p> {% else %}
{% if user.first_name != '' and user.last_name != '' and user.email is not None %} &#x272A; Αν διαθέτετε αριθμό μητρώου, παρακαλούμε συμπληρώστε άμεσα το <br />
{# Insert ALL the OTHER navigation options HERE! #} αντίστοιχο πεδίο του προφίλ επιλέγοντας "Επεξεργασία Προφίλ"!
{# ... #} {% endif %}
{# ... #} </strong>
{# ... #} </p>
{% endif %} {% endif %}
<p><a href="{% url 'logout' %}">Έξοδος</a></p>
</nav> <nav id="home_nav">
{% comment %}
The "Edit Profile" and "Log out" options are ALWAYS available to the user. ALL the OTHER
navigation options are available to him/her ONLY if his/her profile is NON-empty.
{% endcomment %}
<p><a href="{% url 'default_user_profile_edit' %}">Επεξεργασία Προφίλ</a></p>
{% if not empty_user_profile %}
{# Insert ALL the OTHER navigation options HERE! #}
{# ... #}
{# ... #}
{# ... #}
{% endif %}
<p><a href="{% url 'logout' %}">Έξοδος</a></p>
</nav>
{% endwith %}
{% endblock %} {% endblock %}
...@@ -5,91 +5,95 @@ ...@@ -5,91 +5,95 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<nav id="session_nav"> {% with empty_user_profile=user.has_empty_profile %}
{% if user.first_name and user.last_name %} <nav id="session_nav">
Έχετε εισέλθει ως <strong>{{ user.first_name }} {{ user.last_name }}</strong>! {% if not empty_user_profile %}
{% else %} Έχετε εισέλθει ως <strong>{{ user.first_name }} {{ user.last_name }}</strong>!
Έχετε εισέλθει επιτυχώς! {% else %}
{% endif %} Έχετε εισέλθει επιτυχώς!
| <a href="{% url 'user_home' user.id %}">Αρχική Σελίδα</a> {% endif %}
| <a href="{% url 'logout' %}">Έξοδος</a> | <a href="{% url 'user_home' %}">Αρχική Σελίδα</a>
</nav> | <a href="{% url 'logout' %}">Έξοδος</a>
</nav>
<h4>Επεξεργασία Προφίλ Χρήστη</h4> <h4>Επεξεργασία Προφίλ Χρήστη</h4>
{% if user.first_name == '' and user.last_name == '' and user.email is None %} {% if empty_user_profile %}
<p> <p>
<strong> <strong>
&#x272A; Αν καταχωρήσατε τα στοιχεία του προφίλ σας κατά τη διάρκεια παλιότερης εισόδου σας στο σύστημα και <br /> &#x272A; Αν καταχωρήσατε τα στοιχεία του προφίλ σας κατά τη διάρκεια παλιότερης εισόδου σας στο σύστημα και <br />
αυτά δεν εμφανίζονται τώρα στην παρακάτω φόρμα (είτε γιατί έχετε αλλάξει τα διαπιστευτήρια της <br /> αυτά δεν εμφανίζονται τώρα στην παρακάτω φόρμα (είτε γιατί έχετε αλλάξει τα διαπιστευτήρια της <br />
πλατφόρμας εισόδου είτε γιατί έχετε εισέλθει για πρώτη φορά με διαπιστευτήρια αυτής της πλατφόρμας), <br /> πλατφόρμας εισόδου είτε γιατί έχετε εισέλθει για πρώτη φορά με διαπιστευτήρια αυτής της πλατφόρμας), <br />
παρακαλούμε ανακτήστε τα από τη βάση χωρίς να συμπληρώσετε τα πεδία της παρακάτω φόρμας! <br /> παρακαλούμε ανακτήστε τα από τη βάση χωρίς να συμπληρώσετε τα πεδία της παρακάτω φόρμας! <br />
<a href="{% url 'default_user_profile_recovery' user.id %}">&#x2192; Ανάκτηση χωρίς Συμπλήρωση</a> <a href="{% url 'default_user_profile_recovery' %}">&#x2192; Ανάκτηση χωρίς Συμπλήρωση</a>
</strong> </strong>
</p> </p>
<br /> <br />
{% endif %} {% endif %}
<form id="user_profile_edit_form" accept-charset="utf-8" action="{% url 'edit_user_profile' user.id %}" method="post"> <form id="user_profile_edit_form" accept-charset="utf-8" action="{% url 'edit_user_profile' %}" method="post">
{% csrf_token %} {% csrf_token %}
<table> <table>
<tbody> <tbody>
<tr> <tr>
<td style="text-align:right;"><label for="first_name">Όνομα:</label></td> <td style="text-align:right;"><label for="first_name">Όνομα:</label></td>
<td style="text-align:left;"> <td style="text-align:left;">
<input type="text" name="first_name" id="first_name" maxlength="50" <input type="text" name="first_name" id="first_name" maxlength="50"
value="{{ user.first_name }}" required="required" /> value="{{ user.first_name }}" required="required" />
</td> </td>
</tr> </tr>
<tr> <tr>
<td style="text-align:right;"><label for="last_name">Επώνυμο:</label></td> <td style="text-align:right;"><label for="last_name">Επώνυμο:</label></td>
<td style="text-align:left;"> <td style="text-align:left;">
<input type="text" name="last_name" id="last_name" maxlength="50" <input type="text" name="last_name" id="last_name" maxlength="50"
value="{{ user.last_name }}" required="required" /> value="{{ user.last_name }}" required="required" />
</td> </td>
</tr> </tr>
<tr> <tr>
<td style="text-align:right;"><label for="ece_id">Αριθμός μητρώου<span style="color:darkorange;">*</span>:</label></td> <td style="text-align:right;">
<td style="text-align:left;"> <label for="ece_id">Αριθμός μητρώου<span style="color:darkorange;">*</span>:</label>
<input type="text" name="ece_id" id="ece_id" maxlength="8" pattern="031[0-9]{5}" </td>
{% if user.ece_id is not None %}value="{{ user.ece_id }}"{% endif %} /> <td style="text-align:left;">
</td> <input type="text" name="ece_id" id="ece_id" maxlength="8" pattern="031[0-9]{5}"
</tr> {% if user.ece_id is not None %}value="{{ user.ece_id }}"{% endif %} />
<tr> </td>
<td style="text-align:right;"><label for="email">Ηλεκτρονικό ταχυδρομείο:</label></td> </tr>
<td style="text-align:left;"> <tr>
<input type="email" name="email" id="email" maxlength="100" <td style="text-align:right;"><label for="email">Ηλεκτρονικό ταχυδρομείο:</label></td>
{% if user.email is not None %}value="{{ user.email }}"{% endif %} required="required" /> <td style="text-align:left;">
</td> <input type="email" name="email" id="email" maxlength="100"
</tr> {% if user.email is not None %}value="{{ user.email }}"{% endif %} required="required" />
</tbody> </td>
</table> </tr>
</tbody>
</table>
<p style="color:darkorange;"> <p style="color:darkorange;">
<strong> <strong>
* Αν δεν διαθέτετε αριθμό μητρώου ακόμα, μπορείτε προσωρινά να παραλείψετε το αντίστοιχο πεδίο! <br /> * Αν δεν διαθέτετε αριθμό μητρώου ακόμα, μπορείτε προσωρινά να παραλείψετε το αντίστοιχο πεδίο! <br />
Σε αντίθετη περίπτωση, παρακαλούμε συμπληρώστε το άμεσα! Σε αντίθετη περίπτωση, παρακαλούμε συμπληρώστε το άμεσα!
</strong> </strong>
</p> </p>
<input type="submit" value="Αποθήκευση" /> <input type="submit" value="Αποθήκευση" />
</form> </form>
{% if success_message %} {% if success_message %}
<p style="color:green;"> <p style="color:green;">
<img src="images/tick.png" alt="Επιβεβαίωση:" /> <img src="images/tick.png" alt="Επιβεβαίωση:" />
<strong>{{ success_message | linebreaksbr }}</strong> <strong>{{ success_message | linebreaksbr }}</strong>
</p>
{% elif error_messages %}
{% for message in error_messages %}
<p style="color:red;">
<img src="images/warning.svg" alt="Σφάλμα:" />
<strong>{{ message | linebreaksbr }}</strong>
</p> </p>
{% endfor %} {% elif error_messages %}
{% endif %} {% for message in error_messages %}
<p style="color:red;">
<img src="images/warning.svg" alt="Σφάλμα:" />
<strong>{{ message | linebreaksbr }}</strong>
</p>
{% endfor %}
{% endif %}
<p><a href="{% url 'user_home' user.id %}">&#x21B5; Επιστροφή στην Αρχική Σελίδα</a></p> <p><a href="{% url 'user_home' %}">&#x21B5; Επιστροφή στην Αρχική Σελίδα</a></p>
{% endwith %}
{% endblock %} {% endblock %}
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
{% block content %} {% block content %}
<nav id="session_nav"> <nav id="session_nav">
Έχετε εισέλθει επιτυχώς! Έχετε εισέλθει επιτυχώς!
| <a href="{% url 'user_home' user.id %}">Αρχική Σελίδα</a> | <a href="{% url 'user_home' %}">Αρχική Σελίδα</a>
| <a href="{% url 'logout' %}">Έξοδος</a> | <a href="{% url 'logout' %}">Έξοδος</a>
</nav> </nav>
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
</strong> </strong>
</p> </p>
<form id="user_profile_recovery_form" accept-charset="utf-8" action="{% url 'search_for_recovery_user_profile' user.id %}" method="post"> <form id="user_profile_recovery_form" accept-charset="utf-8" action="{% url 'search_for_recovery_user_profile' %}" method="post">
{% csrf_token %} {% csrf_token %}
<table> <table>
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
<strong> <strong>
{{ success_message | linebreaksbr }} {{ success_message | linebreaksbr }}
<br /> <br />
<a href="{% url 'recover_user_profile' user.id recov_user.id %}">&#x2192; Ανάκτηση και Έξοδος</a> <a href="{% url 'recover_user_profile' %}">&#x2192; Ανάκτηση και Έξοδος</a>
</strong> </strong>
</p> </p>
{% elif error_messages %} {% elif error_messages %}
...@@ -63,6 +63,6 @@ ...@@ -63,6 +63,6 @@
{% endfor %} {% endfor %}
{% endif %} {% endif %}
<p><a href="{% url 'default_user_profile_edit' user.id %}">&#x21B5; Επιστροφή στην Επεξεργασία Προφίλ</a></p> <p><a href="{% url 'default_user_profile_edit' %}">&#x21B5; Επιστροφή στην Επεξεργασία Προφίλ</a></p>
{% endblock %} {% endblock %}
"""usermerge URL Configuration """usermerge (application) URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see: The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.0/topics/http/urls/ https://docs.djangoproject.com/en/2.0/topics/http/urls/
...@@ -21,16 +21,13 @@ urlpatterns = [ ...@@ -21,16 +21,13 @@ urlpatterns = [
# The default login page serves as index page. Therefore, its regular route becomes r'^$' instead of r'^login/default$'. # The default login page serves as index page. Therefore, its regular route becomes r'^$' instead of r'^login/default$'.
re_path(r'^$', views.display_default_login_page, name = 'default_login'), re_path(r'^$', views.display_default_login_page, name = 'default_login'),
re_path(r'^login/submit$', views.log_in, name = 'submit_login'), re_path(r'^login/submit$', views.log_in, name = 'submit_login'),
re_path(r'^user/home/id=(\d{1,10})$', views.display_user_home_page, name = 'user_home'), re_path(r'^user/home$', views.display_user_home_page, name = 'user_home'),
re_path(r'^user/profile/edit/default/id=(\d{1,10})$', views.display_default_user_profile_edit_page, name = 'default_user_profile_edit'), re_path(r'^user/profile/edit/default$', views.display_default_user_profile_edit_page, name = 'default_user_profile_edit'),
re_path(r'^user/profile/edit/submit/id=(\d{1,10})$', views.edit_user_profile, name = 'edit_user_profile'), re_path(r'^user/profile/edit/submit$', views.edit_user_profile, name = 'edit_user_profile'),
re_path(r'^user/profile/recovery/default/id=(\d{1,10})$', views.display_default_user_profile_recovery_page, re_path(r'^user/profile/recovery/default$', views.display_default_user_profile_recovery_page, name = 'default_user_profile_recovery'),
name = 'default_user_profile_recovery'), re_path(r'^user/profile/recovery/search$', views.search_for_recovery_user_profile, name = 'search_for_recovery_user_profile'),
re_path(r'^user/profile/recovery/search/id=(\d{1,10})$', views.search_for_recovery_user_profile, re_path(r'^user/profile/recovery/submit$', views.recover_user_profile, name = 'recover_user_profile'),
name = 'search_for_recovery_user_profile'), re_path(r'^admin/home$', views.display_admin_home_page, name = 'admin_home'),
re_path(r'^user/profile/recovery/submit/id=(\d{1,10})/recover/id=(\d{1,10})$', views.recover_user_profile,
name = 'recover_user_profile'),
re_path(r'^admin/home/id=(\d{1,10})$', views.display_admin_home_page, name = 'admin_home'),
re_path(r'^logout$', views.log_out, name = 'logout'), re_path(r'^logout$', views.log_out, name = 'logout'),
] ]
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment