mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-20 19:08:21 +00:00
[two-factor-auth]modify variable name
This commit is contained in:
@@ -9,7 +9,7 @@ from seahub.api2.base import APIView
|
|||||||
from seahub.api2.throttling import UserRateThrottle
|
from seahub.api2.throttling import UserRateThrottle
|
||||||
from seahub.api2.utils import json_response, api_error
|
from seahub.api2.utils import json_response, api_error
|
||||||
from seahub.api2.authentication import TokenAuthentication
|
from seahub.api2.authentication import TokenAuthentication
|
||||||
from seahub.utils.two_factor_auth import has_two_factor_auth, two_factor_auth_enabled
|
from seahub.utils.two_factor_auth import two_factor_auth_enabled
|
||||||
|
|
||||||
|
|
||||||
class TwoFactorAuthView(APIView):
|
class TwoFactorAuthView(APIView):
|
||||||
@@ -22,14 +22,14 @@ class TwoFactorAuthView(APIView):
|
|||||||
error_msg = "email can not be empty"
|
error_msg = "email can not be empty"
|
||||||
return api_error(status.HTTP_400_BAD_REQUEST, error_msg)
|
return api_error(status.HTTP_400_BAD_REQUEST, error_msg)
|
||||||
try:
|
try:
|
||||||
_user = User.objects.get(email=email)
|
user = User.objects.get(email=email)
|
||||||
except User.DoesNotExist:
|
except User.DoesNotExist:
|
||||||
error_msg = "User %s not found" % email
|
error_msg = "User %s not found" % email
|
||||||
return api_error(status.HTTP_400_BAD_REQUEST, error_msg)
|
return api_error(status.HTTP_400_BAD_REQUEST, error_msg)
|
||||||
|
|
||||||
from seahub_extra.two_factor import devices_for_user
|
from seahub_extra.two_factor import devices_for_user
|
||||||
devices = devices_for_user(_user)
|
devices = devices_for_user(user)
|
||||||
if devices:
|
if devices:
|
||||||
for device in devices:
|
for device in devices:
|
||||||
device.delete()
|
device.delete()
|
||||||
return Response({'success':True}, status=status.HTTP_200_OK)
|
return Response({'success': True}, status=status.HTTP_200_OK)
|
||||||
|
@@ -675,12 +675,12 @@ def user_info(request, email):
|
|||||||
else:
|
else:
|
||||||
g.role = _('Member')
|
g.role = _('Member')
|
||||||
|
|
||||||
_default_device = False
|
default_device = False
|
||||||
_has_two_factor_auth = has_two_factor_auth()
|
bool_has_two_factor_auth = has_two_factor_auth()
|
||||||
if _has_two_factor_auth:
|
if bool_has_two_factor_auth:
|
||||||
from seahub_extra.two_factor.utils import default_device
|
from seahub_extra.two_factor.utils import default_device
|
||||||
_user = User.objects.get(email=email)
|
user = User.objects.get(email=email)
|
||||||
_default_device = default_device(_user)
|
default_device = default_device(user)
|
||||||
|
|
||||||
return render_to_response(
|
return render_to_response(
|
||||||
'sysadmin/userinfo.html', {
|
'sysadmin/userinfo.html', {
|
||||||
@@ -695,8 +695,8 @@ def user_info(request, email):
|
|||||||
'user_shared_links': user_shared_links,
|
'user_shared_links': user_shared_links,
|
||||||
'enable_sys_admin_view_repo': ENABLE_SYS_ADMIN_VIEW_REPO,
|
'enable_sys_admin_view_repo': ENABLE_SYS_ADMIN_VIEW_REPO,
|
||||||
'personal_groups': personal_groups,
|
'personal_groups': personal_groups,
|
||||||
'two_factor_auth_enabled': _has_two_factor_auth,
|
'two_factor_auth_enabled': bool_has_two_factor_auth,
|
||||||
'default_device': _default_device,
|
'default_device': default_device,
|
||||||
}, context_instance=RequestContext(request))
|
}, context_instance=RequestContext(request))
|
||||||
|
|
||||||
@login_required_ajax
|
@login_required_ajax
|
||||||
|
Reference in New Issue
Block a user