Moving response generation from auth plugin services to auth api
parent
6553b4d8dc
commit
0905753b0c
|
@ -142,6 +142,7 @@ class AuthViewSet(viewsets.ViewSet):
|
||||||
login_type = request.DATA.get("type", None)
|
login_type = request.DATA.get("type", None)
|
||||||
|
|
||||||
if login_type in auth_plugins:
|
if login_type in auth_plugins:
|
||||||
return auth_plugins[login_type]['login_func'](request)
|
data = auth_plugins[login_type]['login_func'](request)
|
||||||
|
return response.Ok(data)
|
||||||
|
|
||||||
raise exc.BadRequest(_("invalid login type"))
|
raise exc.BadRequest(_("invalid login type"))
|
||||||
|
|
|
@ -201,7 +201,7 @@ def normal_login_func(request):
|
||||||
|
|
||||||
user = get_and_validate_user(username=username, password=password)
|
user = get_and_validate_user(username=username, password=password)
|
||||||
data = make_auth_response_data(user)
|
data = make_auth_response_data(user)
|
||||||
return response.Ok(data)
|
return data
|
||||||
|
|
||||||
|
|
||||||
register_auth_plugin("normal", normal_login_func);
|
register_auth_plugin("normal", normal_login_func);
|
||||||
|
|
Loading…
Reference in New Issue