feat: add password change method
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}A minha conta · {{ settings.app_name }}{% endblock %}
|
||||
{% block content %}
|
||||
<div class="page-head">
|
||||
<div>
|
||||
<p class="eyebrow"><a href="{{ app_path('/') }}">Rota</a></p>
|
||||
<h1>A minha conta</h1>
|
||||
<p class="muted">{{ current_user.name }}{% if current_user.username %} · @{{ current_user.username }}{% endif %}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section class="panel">
|
||||
<h2>Alterar palavra-passe</h2>
|
||||
{% if current_user.can_login %}
|
||||
<form method="post" action="{{ app_path('/account') }}" class="form-grid">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
||||
<label>Palavra-passe atual
|
||||
<input type="password" name="current_password" autocomplete="current-password" required>
|
||||
</label>
|
||||
<label>Nova palavra-passe
|
||||
<input type="password" name="new_password" minlength="4" autocomplete="new-password" required>
|
||||
</label>
|
||||
<label>Repetir a nova palavra-passe
|
||||
<input type="password" name="confirm_password" minlength="4" autocomplete="new-password" required>
|
||||
</label>
|
||||
<div><button class="primary" type="submit">Alterar palavra-passe</button></div>
|
||||
</form>
|
||||
{% else %}
|
||||
<p class="muted">A sua conta ainda não tem palavra-passe. Peça a um administrador que a defina para poder entrar.</p>
|
||||
{% endif %}
|
||||
</section>
|
||||
{% endblock %}
|
||||
@@ -16,7 +16,7 @@
|
||||
<fieldset class="form-col">
|
||||
<legend>Acesso (opcional)</legend>
|
||||
<label>Utilizador<input name="username" pattern="[A-Za-z0-9._-]+"></label>
|
||||
<label>Palavra-passe <span class="muted">(obrigatória com o utilizador)</span><input type="password" name="password" minlength="8"></label>
|
||||
<label>Palavra-passe <span class="muted">(obrigatória com o utilizador)</span><input type="password" name="password" minlength="4"></label>
|
||||
</fieldset>
|
||||
<label class="check"><input type="checkbox" name="notify_email" checked> Notificações por e-mail</label>
|
||||
</form>
|
||||
@@ -35,7 +35,7 @@
|
||||
<fieldset class="form-col">
|
||||
<legend>Acesso</legend>
|
||||
<label>Utilizador <span class="muted">(vazio remove o login)</span><input name="username" pattern="[A-Za-z0-9._-]+" value="{{ person.username or '' }}"></label>
|
||||
<label>Nova palavra-passe <span class="muted">(vazio para manter)</span><input type="password" name="new_password" minlength="8"></label>
|
||||
<label>Nova palavra-passe <span class="muted">(vazio para manter)</span><input type="password" name="new_password" minlength="4"></label>
|
||||
</fieldset>
|
||||
<label class="check"><input type="checkbox" name="notify_email" {% if person.notify_email %}checked{% endif %}> Notificações por e-mail</label>
|
||||
<label class="check"><input type="checkbox" name="is_active" {% if person.is_active %}checked{% endif %}> Ativa</label>
|
||||
|
||||
@@ -28,7 +28,14 @@
|
||||
</nav>
|
||||
{% if current_user %}
|
||||
<div class="account">
|
||||
{% if current_user.can_login %}
|
||||
<a class="account-link" href="{{ app_path('/account') }}" title="A minha conta">
|
||||
<span class="name-text">{{ current_user.name }}</span>
|
||||
<span class="muted">@{{ current_user.username }}</span>
|
||||
</a>
|
||||
{% else %}
|
||||
<span>{{ current_user.name }}</span>
|
||||
{% endif %}
|
||||
<form method="post" action="{{ app_path('/logout') }}">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
||||
<button class="link-button" type="submit">Sair</button>
|
||||
|
||||
Reference in New Issue
Block a user