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
()
| 131 | |
| 132 | |
| 133 | def 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 |
nothing calls this directly
no test coverage detected