Allow multiple ways to access url and fix ci

This commit is contained in:
Chiaki
2017-04-18 15:39:49 +08:00
parent 1fcd13b5e1
commit 3caf2d9d2c
11 changed files with 27 additions and 27 deletions

View File

@@ -3,5 +3,5 @@ from django.conf.urls import url
from ..views.admin import UserAdminAPI
urlpatterns = [
url(r"^user$", UserAdminAPI.as_view(), name="user_admin_api"),
url(r"^user/?$", UserAdminAPI.as_view(), name="user_admin_api"),
]

View File

@@ -7,9 +7,9 @@ from ..views.oj import (UserChangePasswordAPI, UserLoginAPI, UserRegisterAPI,
ApplyResetPasswordAPI, ResetPasswordAPI)
urlpatterns = [
url(r"^login$", UserLoginAPI.as_view(), name="user_login_api"),
url(r"^register$", UserRegisterAPI.as_view(), name="user_register_api"),
url(r"^change_password$", UserChangePasswordAPI.as_view(), name="user_change_password_api"),
url(r"^apply_reset_password$", ApplyResetPasswordAPI.as_view(), name="apply_reset_password_api"),
url(r"^reset_password$", ResetPasswordAPI.as_view(), name="apply_reset_password_api")
url(r"^login/?$", UserLoginAPI.as_view(), name="user_login_api"),
url(r"^register/?$", UserRegisterAPI.as_view(), name="user_register_api"),
url(r"^change_password/?$", UserChangePasswordAPI.as_view(), name="user_change_password_api"),
url(r"^apply_reset_password/?$", ApplyResetPasswordAPI.as_view(), name="apply_reset_password_api"),
url(r"^reset_password/?$", ResetPasswordAPI.as_view(), name="apply_reset_password_api")
]

View File

@@ -7,9 +7,9 @@ from ..views.user import (UserInfoAPI, UserProfileAPI, AvatarUploadAPI,
SSOAPI, TwoFactorAuthAPI)
urlpatterns = [
url(r"^user$", UserInfoAPI.as_view(), name="user_info_api"),
url(r"^profile$", UserProfileAPI.as_view(), name="user_profile_api"),
url(r"^avatar/upload$", AvatarUploadAPI.as_view(), name="avatar_upload_api"),
url(r"^sso$", SSOAPI.as_view(), name="sso_api"),
url(r"^two_factor_auth$", TwoFactorAuthAPI.as_view(), name="two_factor_auth_api")
url(r"^user/?$", UserInfoAPI.as_view(), name="user_info_api"),
url(r"^profile/?$", UserProfileAPI.as_view(), name="user_profile_api"),
url(r"^avatar/upload/?$", AvatarUploadAPI.as_view(), name="avatar_upload_api"),
url(r"^sso/?$", SSOAPI.as_view(), name="sso_api"),
url(r"^two_factor_auth/?$", TwoFactorAuthAPI.as_view(), name="two_factor_auth_api")
]

View File

@@ -122,9 +122,9 @@ class TwoFactorAuthAPI(APIView):
config = WebsiteConfig.objects.first()
image = qrcode.make(OtpAuth(token).to_uri("totp", config.base_url, config.name))
buf = StringIO()
image.save(buf, 'gif')
image.save(buf, "gif")
return HttpResponse(buf.getvalue(), 'image/gif')
return HttpResponse(buf.getvalue(), "image/gif")
@login_required
@validate_serializer(TwoFactorAuthCodeSerializer)