mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
fix layout for password reset
This commit is contained in:
parent
53de59f84b
commit
dbc58b299c
@ -37,7 +37,7 @@ from rest_framework.documentation import include_docs_urls
|
|||||||
|
|
||||||
from .views import auth_request
|
from .views import auth_request
|
||||||
from .views import IndexView, SearchView, DatabaseStatsView
|
from .views import IndexView, SearchView, DatabaseStatsView
|
||||||
from .views import SettingsView, EditUserView, SetPasswordView, CustomEmailView, CustomConnectionsView, CustomPasswordChangeView
|
from .views import SettingsView, EditUserView, SetPasswordView, CustomEmailView, CustomConnectionsView, CustomPasswordChangeView, CustomPasswordResetFromKeyView
|
||||||
from .views import CurrencyRefreshView
|
from .views import CurrencyRefreshView
|
||||||
from .views import AppearanceSelectView, SettingCategorySelectView
|
from .views import AppearanceSelectView, SettingCategorySelectView
|
||||||
from .views import DynamicJsView
|
from .views import DynamicJsView
|
||||||
@ -167,6 +167,7 @@ urlpatterns = [
|
|||||||
url(r'^accounts/email/', CustomEmailView.as_view(), name='account_email'),
|
url(r'^accounts/email/', CustomEmailView.as_view(), name='account_email'),
|
||||||
url(r'^accounts/social/connections/', CustomConnectionsView.as_view(), name='socialaccount_connections'),
|
url(r'^accounts/social/connections/', CustomConnectionsView.as_view(), name='socialaccount_connections'),
|
||||||
url(r'^accounts/password/change/', CustomPasswordChangeView.as_view(), name='account_change_password'),
|
url(r'^accounts/password/change/', CustomPasswordChangeView.as_view(), name='account_change_password'),
|
||||||
|
url(r"^accounts/password/reset/key/(?P<uidb36>[0-9A-Za-z]+)-(?P<key>.+)/$", CustomPasswordResetFromKeyView.as_view(), name="account_reset_password_from_key"),
|
||||||
url(r'^accounts/', include('allauth.urls')), # included urlpatterns
|
url(r'^accounts/', include('allauth.urls')), # included urlpatterns
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ from djmoney.contrib.exchange.models import ExchangeBackend, Rate
|
|||||||
from allauth.account.forms import AddEmailForm
|
from allauth.account.forms import AddEmailForm
|
||||||
from allauth.socialaccount.forms import DisconnectForm
|
from allauth.socialaccount.forms import DisconnectForm
|
||||||
from allauth.account.models import EmailAddress
|
from allauth.account.models import EmailAddress
|
||||||
from allauth.account.views import EmailView, PasswordChangeView
|
from allauth.account.views import EmailView, PasswordChangeView, PasswordResetFromKeyView
|
||||||
from allauth.socialaccount.views import ConnectionsView
|
from allauth.socialaccount.views import ConnectionsView
|
||||||
|
|
||||||
from common.settings import currency_code_default, currency_codes
|
from common.settings import currency_code_default, currency_codes
|
||||||
@ -857,6 +857,13 @@ class CustomPasswordChangeView(LoginRequiredMixin, PasswordChangeView):
|
|||||||
success_url = reverse_lazy("login")
|
success_url = reverse_lazy("login")
|
||||||
|
|
||||||
|
|
||||||
|
class CustomPasswordResetFromKeyView(PasswordResetFromKeyView):
|
||||||
|
"""
|
||||||
|
Override of allauths PasswordResetFromKeyView to always show the settings but leave the functions allow
|
||||||
|
"""
|
||||||
|
success_url = reverse_lazy("account_login")
|
||||||
|
|
||||||
|
|
||||||
class CurrencyRefreshView(RedirectView):
|
class CurrencyRefreshView(RedirectView):
|
||||||
"""
|
"""
|
||||||
POST endpoint to refresh / update exchange rates
|
POST endpoint to refresh / update exchange rates
|
||||||
|
23
InvenTree/templates/account/password_reset_from_key.html
Normal file
23
InvenTree/templates/account/password_reset_from_key.html
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{% extends "account/base.html" %}
|
||||||
|
|
||||||
|
{% load i18n crispy_forms_tags %}
|
||||||
|
{% block head_title %}{% trans "Change Password" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<h1>{% if token_fail %}{% trans "Bad Token" %}{% else %}{% trans "Change Password" %}{% endif %}</h1>
|
||||||
|
|
||||||
|
{% if token_fail %}
|
||||||
|
{% url 'account_reset_password' as passwd_reset_url %}
|
||||||
|
<p>{% blocktrans %}The password reset link was invalid, possibly because it has already been used. Please request a <a href="{{ passwd_reset_url }}">new password reset</a>.{% endblocktrans %}</p>
|
||||||
|
{% else %}
|
||||||
|
{% if form %}
|
||||||
|
<form method="POST" action="{{ action_url }}">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form|crispy }}
|
||||||
|
<input type="submit" name="action" class="btn btn-primary btn-block" value="{% trans 'change password' %}"/>
|
||||||
|
</form>
|
||||||
|
{% else %}
|
||||||
|
<p>{% trans 'Your password is now changed.' %}</p>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
Loading…
Reference in New Issue
Block a user