8aeefa07 by 周伟奇

admin test8

1 parent 5df67344
...@@ -6,4 +6,5 @@ urlpatterns = [ ...@@ -6,4 +6,5 @@ urlpatterns = [
6 path(r'login/', views.LoginView.as_view()), 6 path(r'login/', views.LoginView.as_view()),
7 path(r'iwalogin/', views.IWALoginView.as_view()), 7 path(r'iwalogin/', views.IWALoginView.as_view()),
8 path(r'iwaurl/', views.IWAUrlView.as_view()), 8 path(r'iwaurl/', views.IWAUrlView.as_view()),
9 path(r'testlogin/', views.TestView.as_view()),
9 ] 10 ]
......
...@@ -95,3 +95,26 @@ class IWAUrlView(IWABaseView, GenericView): ...@@ -95,3 +95,26 @@ class IWAUrlView(IWABaseView, GenericView):
95 'iwa_url': iwa_url, 95 'iwa_url': iwa_url,
96 } 96 }
97 return response.ok(data=data) 97 return response.ok(data=data)
98
99
100 class TestView(IWABaseView, GenericView):
101
102 def get(self, request, *args, **kwargs):
103 # code = request.data.get('code', '')
104 # is_admin = request.data.get('state', '') == 'admin'
105 # q_number = self.get_q_number(conf.IWA_URL, code, conf.IWA_REDIRECT_URI, client_id_base64)
106
107 q_number = 'admin'
108
109 self.running_log.info('[admin_users.iwalogin] [username: {0}] [params: {1}]'.format(q_number, request.data))
110
111 is_valid, data = self.validate_admin(q_number)
112
113 if is_valid:
114 request.user = data
115 auth_login(request, data)
116 index_path = reverse('admin:index')
117 return HttpResponseRedirect(index_path)
118 # return redirect('https://staging-bmw-ocr.situdata.com/admin/')
119 else:
120 self.no_permission(data)
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!