Reworked Password-Reset flow (#1627)

* Reworked Password-Reset flow
- No more Passwords sent via E-Mail
- Correct redirects.

* Fixed spelling & last redirect

* Small fixes and updated tests for pw-reset-flow

* Fixed tests for pw-reset-flow

* Fixed tests for the Password reset flow

* Fixed typos, resolved Feedback

* Renamed event before password reset

* Renamed event after password reset

* Tweak a few comments, send the reset email instantly

---------

Co-authored-by: Christoph Schläpfer <c.schlaepfer@datact.ch>
Co-authored-by: Belle Aerni <belleaerni@gmail.com>
This commit is contained in:
authored and GitHub committed 2023-09-22 18:15:18 -07:00
1 parent cba659534c
commit 3ee7f29689
8 files changed
+296 -123

No files matched your search

@@ -0,0 +1,72 @@
{% extends "layout_public.html.twig" %}
{% block meta_title %}{{ 'Set new Password'|trans }}{% endblock %}
{% block body_class %}page-set-password{% endblock %}
{% block body %}
<section class="container login" role="main">
{% if settings.login_page_show_logo %}
{% set company = guest.system_company %}
<h1 style="text-align: center">
{% if settings.login_page_show_logo %}
<a href="{{ settings.login_page_logo_url|default('/') }}" target="_blank">
<img src="{{ guest.system_company.logo_url }}" alt="{{ guest.system_company.name }}"/>
</a>
{% endif %}
</h1>
{% endif %}
<h2>{{ 'Set new password'|trans }}</h2>
<div class="data-block">
<div class="data-container">
<form class="api-form" action="{{ 'api/guest/client/update_password'|link }}" method="post" data-api-redirect="{{ '/login'|link }}">
<input type="hidden" name="CSRFToken" value="{{ CSRFToken }}"/>
<input type="hidden" id="hash" name="hash" value="{{ hash }}"/>
<fieldset>
<div class="control-group">
<label class="control-label" for="password">{{ 'New password'|trans }}</label>
<div class="controls">
<input id="password" type="password" placeholder="{{ 'New password'|trans }}" name="password" required="required" value>
<div class="help-block"></div>
</div>
</div>
<div class="control-group">
<label class="control-label" for="password2">{{ 'Repeat new password'|trans }}</label>
<div class="controls">
<input id="password2" type="password" placeholder="{{ 'Repeat new password' | trans }}" name="password_confirm" required="required" value>
<div class="help-block"></div>
</div>
</div>
<div class="form-actions">
<button class="btn btn-block btn-large btn-inverse btn-alt" type="submit">{{ 'Set new password'|trans }}</button>
</div>
</fieldset>
</form>
</div>
</div>
{% if settings.show_password_reset_link or settings.show_signup_link %}
<ul class="login-footer">
{% if settings.show_signup_link%}
<li><a href="{{ 'signup'|link }}"><small>{{ 'Sign Up'|trans }}</small></a></li>
{% endif %}
</ul>
<li><a href="{{ 'login'|link }}"><small>{{ 'Login'|trans }}</small></a></li>
{% endif %}
</section>
{% endblock%}
{% block js %}
<script type="text/javascript">
// Set value of hash field to last part of URL
$(document).ready(function() {
var hash = window.location.href.split('/').pop();
$('#hash').val(hash);
});
</script>
{% endblock %}