提交 96551856 编写于 作者: baltery's avatar baltery

[Update] 部分view放到auth中

上级 b1f5cc77
......@@ -46,7 +46,7 @@
<div class="text-muted text-center">
<div>
<a href="{% url 'users:forgot-password' %}">
<a href="{% url 'authentication:forgot-password' %}">
<small>{% trans 'Forgot password' %}?</small>
</a>
</div>
......
......@@ -112,7 +112,7 @@
<button type="submit" class="btn btn-transparent">{% trans 'Login' %}</button>
</div>
<div style="text-align: center">
<a href="{% url 'users:forgot-password' %}">
<a href="{% url 'authentication:forgot-password' %}">
<small>{% trans 'Forgot password' %}?</small>
</a>
</div>
......
......@@ -4,6 +4,7 @@
from django.urls import path, include
from .. import views
from users import views as users_view
app_name = 'authentication'
......@@ -15,6 +16,24 @@ urlpatterns = [
path('login/guard/', views.UserLoginGuardView.as_view(), name='login-guard'),
path('logout/', views.UserLogoutView.as_view(), name='logout'),
# 原来在users中的
path('password/forgot/', users_view.UserForgotPasswordView.as_view(), name='forgot-password'),
path('password/forgot/sendmail-success/', users_view.UserForgotPasswordSendmailSuccessView.as_view(),
name='forgot-password-sendmail-success'),
path('password/reset/', users_view.UserResetPasswordView.as_view(), name='reset-password'),
path('password/reset/success/', users_view.UserResetPasswordSuccessView.as_view(), name='reset-password-success'),
path('password/verify/', users_view.UserVerifyPasswordView.as_view(), name='user-verify-password'),
# Profile
path('profile/otp/enable/start/', users_view.UserOtpEnableStartView.as_view(), name='user-otp-enable-start'),
path('profile/otp/enable/install-app/', users_view.UserOtpEnableInstallAppView.as_view(),
name='user-otp-enable-install-app'),
path('profile/otp/enable/bind/', users_view.UserOtpEnableBindView.as_view(), name='user-otp-enable-bind'),
path('profile/otp/disable/authentication/', users_view.UserDisableMFAView.as_view(),
name='user-otp-disable-authentication'),
path('profile/otp/update/', users_view.UserOtpUpdateView.as_view(), name='user-otp-update'),
path('profile/otp/settings-success/', users_view.UserOtpSettingsSuccessView.as_view(), name='user-otp-settings-success'),
# openid
path('cas/', include(('authentication.backends.cas.urls', 'authentication'), namespace='cas')),
path('openid/', include(('jms_oidc_rp.urls', 'authentication'), namespace='openid')),
......
......@@ -67,7 +67,7 @@ if settings.XPACK_ENABLED:
)
js_i18n_patterns = i18n_patterns(
path('jsi18n/', JavaScriptCatalog.as_view(), name='javascript-catalog'),
# path('jsi18n/', JavaScriptCatalog.as_view(), name='javascript-catalog'),
)
......@@ -87,6 +87,7 @@ urlpatterns = [
# External apps url
path('core/auth/captcha/', include('captcha.urls')),
path('core/', include(app_view_patterns)),
path('ui/', views.UIView.as_view())
]
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) \
......
......@@ -16,7 +16,7 @@ from common.http import HttpResponseTemporaryRedirect
__all__ = [
'LunaView', 'I18NView', 'KokoView', 'WsView', 'HealthCheckView',
'redirect_format_api', 'redirect_old_apps_view'
'redirect_format_api', 'redirect_old_apps_view', 'UIView'
]
......@@ -75,6 +75,12 @@ class WsView(APIView):
return JsonResponse({"msg": msg})
class UIView(View):
def get(self, request):
msg = "如果你能看到这个页面,证明你的配置是有问题的,请参考文档设置好nginx, UI由Lina项目提供"
return HttpResponse(msg)
class KokoView(View):
def get(self, request):
msg = _(
......
......@@ -437,7 +437,7 @@ class MFAMixin:
if not self.mfa_enabled:
return False, None
if self.mfa_is_otp() and not self.otp_secret_key:
return True, reverse('users:user-otp-enable-start')
return True, reverse('authentication:user-otp-enable-start')
return False, None
......
......@@ -26,7 +26,7 @@
<p style="margin: 20px auto;"><strong style="color: #000000">{% trans 'After installation, click the next step to enter the binding page (if installed, go to the next step directly).' %}</strong></p>
</div>
<a href="{% url 'users:user-otp-enable-bind' %}" class="next">{% trans 'Next' %}</a>
<a href="{% url 'authentication:user-otp-enable-bind' %}" class="next">{% trans 'Next' %}</a>
<script>
$(function(){
......
......@@ -162,11 +162,11 @@
{% if request.user.mfa_force_enabled %}
" disabled >{% trans 'Disable' %}
{% else %}
{% url 'users:user-otp-disable-authentication' %}
{% url 'authentication:user-otp-disable-authentication' %}
">{% trans 'Disable' %}
{% endif %}
{% else %}
{% url 'users:user-otp-enable-start' %}
{% url 'authentication:user-otp-enable-start' %}
">{% trans 'Enable' %}
{% endif %}
</a>
......@@ -178,7 +178,7 @@
<td>{% trans 'Update MFA' %}:</td>
<td>
<span class="pull-right">
<a type="button" class="btn btn-primary btn-xs" style="width: 54px" href="{% url 'users:user-otp-update' %}">{% trans 'Update' %}</a>
<a type="button" class="btn btn-primary btn-xs" style="width: 54px" href="{% url 'authentication:user-otp-update' %}">{% trans 'Update' %}</a>
</span>
</td>
</tr>
......
......@@ -38,9 +38,9 @@ def construct_user_created_email_body(user):
</div>
""") % {
'username': user.username,
'rest_password_url': reverse('users:reset-password', external=True),
'rest_password_url': reverse('authentication:reset-password', external=True),
'rest_password_token': user.generate_reset_token(),
'forget_password_url': reverse('users:forgot-password', external=True),
'forget_password_url': reverse('authentication:forgot-password', external=True),
'email': user.email,
'login_url': reverse('authentication:login', external=True),
}
......@@ -100,9 +100,9 @@ def send_reset_password_mail(user):
<br>
""") % {
'name': user.name,
'rest_password_url': reverse('users:reset-password', external=True),
'rest_password_url': reverse('authentication:reset-password', external=True),
'rest_password_token': user.generate_reset_token(),
'forget_password_url': reverse('users:forgot-password', external=True),
'forget_password_url': reverse('authentication:forgot-password', external=True),
'email': user.email,
'login_url': reverse('authentication:login', external=True),
}
......@@ -140,7 +140,7 @@ def send_password_expiration_reminder_mail(user):
'date_password_expired': datetime.fromtimestamp(datetime.timestamp(
user.date_password_expired)).strftime('%Y-%m-%d %H:%M'),
'update_password_url': reverse('users:user-password-update', external=True),
'forget_password_url': reverse('users:forgot-password', external=True),
'forget_password_url': reverse('authentication:forgot-password', external=True),
'email': user.email,
'login_url': reverse('authentication:login', external=True),
}
......
......@@ -51,7 +51,7 @@ class UserForgotPasswordView(FormView):
return self.form_invalid(form)
else:
send_reset_password_mail(user)
return redirect('users:forgot-password-sendmail-success')
return redirect('authentication:forgot-password-sendmail-success')
class UserForgotPasswordSendmailSuccessView(TemplateView):
......@@ -126,7 +126,7 @@ class UserResetPasswordView(FormView):
user.reset_password(password)
User.expired_reset_password_token(token)
return redirect('users:reset-password-success')
return redirect('authentication:reset-password-success')
class UserFirstLoginView(PermissionsMixin, SessionWizardView):
......
......@@ -30,9 +30,9 @@ class UserOtpEnableStartView(UserVerifyPasswordView):
def get_success_url(self):
if settings.OTP_IN_RADIUS:
success_url = reverse_lazy('users:user-otp-settings-success')
success_url = reverse_lazy('authentication:user-otp-settings-success')
else:
success_url = reverse('users:user-otp-enable-install-app')
success_url = reverse('authentication:user-otp-enable-install-app')
return success_url
......@@ -49,7 +49,7 @@ class UserOtpEnableInstallAppView(TemplateView):
class UserOtpEnableBindView(TemplateView, FormView):
template_name = 'users/user_otp_enable_bind.html'
form_class = forms.UserCheckOtpCodeForm
success_url = reverse_lazy('users:user-otp-settings-success')
success_url = reverse_lazy('authentication:user-otp-settings-success')
def form_valid(self, form):
otp_code = form.cleaned_data.get('otp_code')
......@@ -86,7 +86,7 @@ class UserOtpEnableBindView(TemplateView, FormView):
class UserDisableMFAView(FormView):
template_name = 'users/user_verify_mfa.html'
form_class = forms.UserCheckOtpCodeForm
success_url = reverse_lazy('users:user-otp-settings-success')
success_url = reverse_lazy('authentication:user-otp-settings-success')
permission_classes = [IsValidUser]
def form_valid(self, form):
......@@ -107,7 +107,7 @@ class UserDisableMFAView(FormView):
class UserOtpUpdateView(FormView):
template_name = 'users/user_verify_mfa.html'
form_class = forms.UserCheckOtpCodeForm
success_url = reverse_lazy('users:user-otp-enable-bind')
success_url = reverse_lazy('authentication:user-otp-enable-bind')
permission_classes = [IsValidUser]
def form_valid(self, form):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册