File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change
1
+ import base64
2
+
3
+
4
+ def get_basic_auth_token (username : str , password : str ) -> str :
5
+ userpass = username + ':' + password
6
+ encoded_u = base64 .b64encode (userpass .encode ()).decode ()
7
+
8
+ return encoded_u
Original file line number Diff line number Diff line change 13
13
from rest_framework .views import APIView
14
14
from rest_framework .decorators import api_view
15
15
16
+ from account .logics import get_basic_auth_token
16
17
from account .view_models import UserTicketInfo
17
18
from ticket .models import Ticket
18
19
@@ -44,6 +45,9 @@ class MyPage(APIView):
44
45
def get (self , request ):
45
46
dto = {
46
47
"ticket" : self .get_ticket_info (request )
48
+ # "session": None, # TODO 세션
49
+ # "sponsor": None, # TODO 후원사
50
+ # "user_info": None # TODO 사용자 정보
47
51
}
48
52
49
53
return Response (dto )
@@ -82,8 +86,10 @@ def login_api(request):
82
86
login (request , user , backend = "django.contrib.auth.backends.ModelBackend" )
83
87
84
88
response_data = {
85
- "msg" : "ok"
89
+ "msg" : "ok" ,
90
+ "basic_auth_token" : get_basic_auth_token (request .data ["username" ], request .data ["password" ])
86
91
}
92
+
87
93
return Response (response_data )
88
94
89
95
You can’t perform that action at this time.
0 commit comments