aurweb/templates/passreset.html
Kevin Morris a33d076d8b add passreset routes
Introduced `get|post` `/passreset` routes. These routes mimic the
behavior of the existing PHP implementation, with the exception of
HTTP status code returns.

Routes added:
    GET /passreset
    POST /passreset

Routers added:
    aurweb.routers.accounts

* On an unknown user or mismatched resetkey (where resetkey must ==
  user.resetkey), return HTTP status NOT_FOUND (404).
* On another error in the request, return HTTP status BAD_REQUEST (400).

Both `get|post` routes requires that the current user is **not**
authenticated, hence `@auth_required(False, redirect="/")`.

+ Added auth_required decorator to aurweb.auth.
+ Added some more utility to aurweb.models.user.User.
+ Added `partials/error.html` template.
+ Added `passreset.html` template.
+ Added aurweb.db.ConnectionExecutor functor for paramstyle logic.
  Decoupling the executor logic from the database connection logic
  is needed for us to easily use the same logic with a fastapi
  database session, when we need to use aurweb.scripts modules.

At this point, notification configuration is now required to complete
tests involved with notifications properly, like passreset.
`conf/config.dev` has been modified to include [notifications] sendmail,
sender and reply-to overrides. Dockerfile and .gitlab-ci.yml have been
updated to setup /etc/hosts and start postfix before running tests.

* setup.cfg: ignore E741, C901 in aurweb.routers.accounts

These two warnings (shown in the commit) are not dangerous and a bi-product
of maintaining compatibility with our current code flow.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-06-05 20:11:17 -07:00

76 lines
3.3 KiB
HTML

{% extends "partials/layout.html" %}
{% block pageContent %}
<div class="box">
<h2>{% trans %}Password Reset{% endtrans %}</h2>
<p>
{% if step == "confirm" %}
{% trans %}Check your e-mail for the confirmation link.{% endtrans %}
{% elif step == "complete" %}
{% trans %}Your password has been reset successfully.{% endtrans %}
{% elif resetkey %}
<!-- Provided with a resetkey. -->
{% include "partials/error.html" %}
<form method="post">
<table>
<tbody>
<tr>
<td>{% trans %}Confirm your user name or primary e-mail address:{% endtrans %}</td>
<td>
<input type="text" name="user" size="30" maxlength="64"
value="{{ user or '' }}">
</td>
</tr>
<tr>
<td>{% trans %}Enter your new password:{% endtrans %}</td>
<td>
<input type="password" name="password" size="30"
value="{{ password or '' }}">
</td>
</tr>
<tr>
<td>{% trans %}Confirm your new password:{% endtrans %}</td>
<td>
<input type="password" name="confirm" size="30"
value="{{ confirm or '' }}">
</td>
</tr>
</tbody>
</table>
<br>
<input type="hidden" name="resetkey"
value="{{ resetkey }}">
<input class="button" type="submit"
value="{% trans %}Continue{% endtrans %}">
</form>
{% else %}
<!-- Default page with prompt for user name/e-mail. -->
{% set url = "https://mailman.archlinux.org/mailman/listinfo/aur-general" %}
{{ "If you have forgotten the user name and the primary e-mail "
"address you used to register, please send a message to the "
"%saur-general%s mailing list."
| tr
| format(
'<a href="%s">' | format(url),
"</a>")
| safe
}}
</p>
{% include "partials/error.html" %}
<form method="post">
<p>
{% trans %}Enter your user name or your primary e-mail address:{% endtrans %}
<input type="text" name="user" size="30" maxlength="64"
value="{{ user or '' }}">
</p>
<input class="button" type="submit"
value="{% trans %}Continue{% endtrans %}">
</form>
{% endif %}
</p>
</div>
{% endblock %}