diff --git a/docs/en_US/images/change_user_password.png b/docs/en_US/images/change_user_password.png
index 15a9a3b2c..7dc51ff66 100644
Binary files a/docs/en_US/images/change_user_password.png and b/docs/en_US/images/change_user_password.png differ
diff --git a/docs/en_US/images/login.png b/docs/en_US/images/login.png
index 982322fc9..41ef542d5 100644
Binary files a/docs/en_US/images/login.png and b/docs/en_US/images/login.png differ
diff --git a/docs/en_US/images/login_recover.png b/docs/en_US/images/login_recover.png
index f0a303f69..ce2200d3a 100644
Binary files a/docs/en_US/images/login_recover.png and b/docs/en_US/images/login_recover.png differ
diff --git a/docs/en_US/images/mfa_registration.png b/docs/en_US/images/mfa_registration.png
index 680dce3ca..abb5062da 100644
Binary files a/docs/en_US/images/mfa_registration.png and b/docs/en_US/images/mfa_registration.png differ
diff --git a/docs/en_US/images/oauth2_login.png b/docs/en_US/images/oauth2_login.png
index 512814dcc..3fac4eda7 100644
Binary files a/docs/en_US/images/oauth2_login.png and b/docs/en_US/images/oauth2_login.png differ
diff --git a/docs/en_US/kerberos.rst b/docs/en_US/kerberos.rst
index 7f333ed1a..7f1befdff 100644
--- a/docs/en_US/kerberos.rst
+++ b/docs/en_US/kerberos.rst
@@ -32,7 +32,7 @@ from *config.py* file and modify the values for the following parameters.
* [‘kerberos’, ‘internal’]: pgAdmin will first try to authenticate the user
through kerberos. If that authentication fails, then it will return back
- to the login dialog where you need to provide internal pgAdmin user
+ to the login page where you need to provide internal pgAdmin user
credentials for authentication."
"KERBEROS_AUTO_CREATE_USER", "Set the value to *True* if you want to
automatically create a pgAdmin user corresponding to a successfully
diff --git a/docs/en_US/login.rst b/docs/en_US/login.rst
index 356796ea4..798b3de4e 100644
--- a/docs/en_US/login.rst
+++ b/docs/en_US/login.rst
@@ -1,16 +1,16 @@
.. _login:
*********************
-`Login Dialog`:index:
+`Login Page`:index:
*********************
-Use the *Login* dialog to log in to pgAdmin:
+Use the *Login* page to log in to pgAdmin:
.. image:: images/login.png
- :alt: pgAdmin login dialog
+ :alt: pgAdmin login page
:align: center
-Use the fields in the *Login* dialog to authenticate your connection. There are
+Use the fields in the *Login* page to authenticate your connection. There are
two ways to authenticate your connection:
- From pgAdmin version 4.21 onwards, support for LDAP authentication
@@ -52,7 +52,7 @@ to launch a password recovery utility.
If you have forgotten the email associated with your account, please contact
your administrator.
-Please note that your LDAP password cannot be recovered using this dialog. If
+Please note that your LDAP password cannot be recovered using this page. If
you enter your LDAP username in the *Email Address/Username* field, and then
enter your email to recover your password, an error message will be displayed
asking you to contact the LDAP administrator to recover your LDAP password.
diff --git a/docs/en_US/webserver.rst b/docs/en_US/webserver.rst
index 2de1d6630..f753c710c 100644
--- a/docs/en_US/webserver.rst
+++ b/docs/en_US/webserver.rst
@@ -27,7 +27,7 @@ and modify the values for the following parameters:
* [‘webserver’, ‘internal’]: pgAdmin will first try to authenticate the user
through webserver. If that authentication fails, then it will return back
- to the login dialog where you need to provide internal pgAdmin user
+ to the login page where you need to provide internal pgAdmin user
credentials for authentication."
"WEBSERVER_AUTO_CREATE_USER", "Set the value to *True* if you want to automatically
create a pgAdmin user corresponding to a successfully authenticated Webserver user.
diff --git a/web/pgadmin/authenticate/__init__.py b/web/pgadmin/authenticate/__init__.py
index 5e891a99c..cc7c6e8d2 100644
--- a/web/pgadmin/authenticate/__init__.py
+++ b/web/pgadmin/authenticate/__init__.py
@@ -27,7 +27,8 @@ from flask_socketio import disconnect, ConnectionRefusedError
from pgadmin.model import db, User
from pgadmin.utils import PgAdminModule, get_safe_post_login_redirect
-from pgadmin.utils.constants import KERBEROS, INTERNAL, OAUTH2, LDAP
+from pgadmin.utils.constants import KERBEROS, INTERNAL, OAUTH2, LDAP,\
+ MessageType
from pgadmin.authenticate.registry import AuthSourceRegistry
MODULE_NAME = 'authenticate'
@@ -132,7 +133,7 @@ def _login():
if user.login_attempts >= config.MAX_LOGIN_ATTEMPTS > 0:
flash(gettext('Your account is locked. Please contact the '
'Administrator.'),
- 'warning')
+ MessageType.WARNING)
logout_user()
return redirect(get_post_logout_redirect())
@@ -158,7 +159,7 @@ def _login():
if flash_login_attempt_error:
error = error + flash_login_attempt_error
flash_login_attempt_error = None
- flash(error, 'warning')
+ flash(error, MessageType.WARNING)
return redirect(get_post_logout_redirect())
@@ -175,7 +176,7 @@ def _login():
return redirect('{0}?next={1}'.format(url_for(
'authenticate.kerberos_login'), url_for('browser.index')))
- flash(msg, 'danger')
+ flash(msg, MessageType.ERROR)
return redirect(get_post_logout_redirect())
session['auth_source_manager'] = current_auth_obj
@@ -194,7 +195,7 @@ def _login():
return msg
if 'auth_obj' in session:
session.pop('auth_obj')
- flash(msg, 'danger')
+ flash(msg, MessageType.ERROR)
form_class = _security.forms.get('login_form').cls
form = form_class()
@@ -268,7 +269,7 @@ class AuthSourceManager:
if status:
return True
if err_msg:
- flash(err_msg, 'warning')
+ flash(err_msg, MessageType.WARNING)
return False
def authenticate(self):
diff --git a/web/pgadmin/authenticate/kerberos.py b/web/pgadmin/authenticate/kerberos.py
index 479acf021..ab052b471 100644
--- a/web/pgadmin/authenticate/kerberos.py
+++ b/web/pgadmin/authenticate/kerberos.py
@@ -23,7 +23,7 @@ from flask_security import login_required
import config
from pgadmin.model import User
from pgadmin.tools.user_management import create_user
-from pgadmin.utils.constants import KERBEROS
+from pgadmin.utils.constants import KERBEROS, MessageType
from pgadmin.utils import PgAdminModule
from pgadmin.utils.ajax import make_json_response, internal_server_error
@@ -199,7 +199,7 @@ class KerberosAuthentication(BaseAuthentication):
retval = self.__auto_create_user(
str(negotiate.initiator_name))
elif isinstance(negotiate, Exception):
- flash(gettext(negotiate), 'danger')
+ flash(gettext(negotiate), MessageType.ERROR)
retval = [status,
Response(render_template(
"security/login_user.html",
@@ -209,8 +209,8 @@ class KerberosAuthentication(BaseAuthentication):
str(base64.b64encode(negotiate), 'utf-8'))
return False, Response("Success", 200, headers)
else:
- flash(gettext("Kerberos authentication failed."
- " Couldn't find kerberos ticket."), 'danger')
+ flash(gettext("Kerberos authentication failed. Couldn't find "
+ "kerberos ticket."), MessageType.ERROR)
headers.add('WWW-Authenticate', 'Negotiate')
retval = [False,
Response(render_template(
diff --git a/web/pgadmin/authenticate/mfa/authenticator.py b/web/pgadmin/authenticate/mfa/authenticator.py
index 9f377c26d..dcc2c40d0 100644
--- a/web/pgadmin/authenticate/mfa/authenticator.py
+++ b/web/pgadmin/authenticate/mfa/authenticator.py
@@ -24,6 +24,7 @@ from pgadmin.model import UserMFA
from .registry import BaseMFAuth
from .utils import ValidationException, fetch_auth_option, mfa_add
+from pgadmin.utils.constants import MessageType
_TOTP_AUTH_METHOD = "authenticator"
@@ -119,14 +120,7 @@ class TOTPAuthenticator(BaseMFAuth):
Returns:
str: Authentication view as a string
"""
- return (
- "
{auth_description}
"
- "
"
- " "
- "
"
- ).format(
+ return dict(
auth_description=_(
"Enter the code shown in your authenticator application for "
"TOTP (Time-based One-Time Password)"
@@ -162,6 +156,17 @@ class TOTPAuthenticator(BaseMFAuth):
img.save(buffered, format="JPEG")
img_base64 = base64.b64encode(buffered.getvalue())
+ return dict(
+ auth_title=_(_TOTP_AUTHENTICATOR),
+ auth_method=_TOTP_AUTH_METHOD,
+ image=img_base64.decode("utf-8"),
+ qrcode_alt_text=_("TOTP Authenticator QRCode"),
+ auth_description=_(
+ "Scan the QR code and the enter the code from the "
+ "TOTP Authenticator application"
+ ), otp_placeholder=_("Enter code")
+ )
+
return "".join([
"
{auth_title}
",
"",
@@ -210,13 +215,13 @@ class TOTPAuthenticator(BaseMFAuth):
authenticator_opt = session.get('mfa_authenticator_opt', None)
if authenticator_opt is None or \
pyotp.TOTP(authenticator_opt).verify(code) is False:
- flash(_("Failed to validate the code"), "danger")
+ flash(_("Failed to validate the code"), MessageType.ERROR)
return self._registration_view()
mfa_add(_TOTP_AUTH_METHOD, authenticator_opt)
flash(_(
"TOTP Authenticator registered successfully for authentication."
- ), "success")
+ ), MessageType.SUCCESS)
session.pop('mfa_authenticator_opt', None)
return None
diff --git a/web/pgadmin/authenticate/mfa/email.py b/web/pgadmin/authenticate/mfa/email.py
index 52b0f58b8..e106c7f48 100644
--- a/web/pgadmin/authenticate/mfa/email.py
+++ b/web/pgadmin/authenticate/mfa/email.py
@@ -18,6 +18,7 @@ import config
from pgadmin.utils.csrf import pgCSRFProtect
from .registry import BaseMFAuth
from .utils import ValidationException, mfa_add, fetch_auth_option
+from pgadmin.utils.constants import MessageType
def __generate_otp() -> str:
@@ -154,10 +155,7 @@ def send_email_code() -> Response:
if success is False:
return Response(message, http_code, mimetype='text/html')
- return Response(render_template(
- "mfa/email_code_sent.html", _=_,
- message=message,
- ), http_code, mimetype='text/html')
+ return dict(message=message)
@pgCSRFProtect.exempt
@@ -204,28 +202,15 @@ class EmailAuthentication(BaseMFAuth):
def validation_view(self):
session.pop("mfa_email_code", None)
- return render_template(
- "mfa/email_view.html", _=_
+ return dict(
+ description=_("Verify with Email Authentication"),
+ button_label=_("Send Code"),
+ button_label_sending=_("Sending Code...")
)
def _registration_view(self):
email = getattr(current_user, 'email', '')
- return "\n".join([
- "
{label}
",
- "",
- "",
- "
{description}
",
- "
",
- " ",
- "
",
- "
",
- " {note_label}:{note}",
- "
",
- ]).format(
+ return dict(
label=email_authentication_label(),
auth_method=EMAIL_AUTH_METHOD,
description=_("Enter the email address to send a code"),
@@ -247,20 +232,10 @@ class EmailAuthentication(BaseMFAuth):
)
if success is False:
- flash(message, 'danger')
+ flash(message, MessageType.ERROR)
return None
- return "\n".join([
- "