MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / send_email_code

Function send_email_code

web/pgadmin/authenticate/mfa/email.py:133–158  ·  view source on GitHub ↗

Send the code to the users' email address, stored during the registration. Raises: ValidationException: Raise this exception when user is not registered for this authentication method. Returns: Flask.Response: Response containing the HTML portion after sending

()

Source from the content-addressed store, hash-verified

131
132
133def send_email_code() -> Response:
134 """
135 Send the code to the users' email address, stored during the registration.
136
137 Raises:
138 ValidationException: Raise this exception when user is not registered
139 for this authentication method.
140
141 Returns:
142 Flask.Response: Response containing the HTML portion after sending the
143 code to the registered email address of the user.
144 """
145
146 options, found = fetch_auth_option(EMAIL_AUTH_METHOD)
147
148 if found is False:
149 raise ValidationException(_(
150 "User has not registered for email authentication"
151 ))
152
153 success, http_code, message = _send_code_to_email(options)
154
155 if success is False:
156 return Response(message, http_code, mimetype='text/html')
157
158 return dict(message=message)
159
160
161@pgCSRFProtect.exempt

Callers

nothing calls this directly

Calls 3

fetch_auth_optionFunction · 0.85
ValidationExceptionClass · 0.85
_send_code_to_emailFunction · 0.85

Tested by

no test coverage detected