Статистика для дашборда #7
This commit is contained in:
@@ -133,7 +133,7 @@ authenticate_admin_request(_Req, Email, Password) ->
|
||||
case logic_auth:authenticate_admin(Email, Password) of
|
||||
{ok, AdminMap} ->
|
||||
Role = maps:get(role, AdminMap, <<"admin">>),
|
||||
case admin_utils:is_admin(Role) of
|
||||
case is_admin_role(Role) of
|
||||
true ->
|
||||
AdminId = maps:get(id, AdminMap),
|
||||
Token = generate_admin_token(AdminId, Role),
|
||||
@@ -143,6 +143,9 @@ authenticate_admin_request(_Req, Email, Password) ->
|
||||
Error -> Error
|
||||
end.
|
||||
|
||||
is_admin_role(Role) ->
|
||||
lists:member(Role, [<<"admin">>, <<"superadmin">>, <<"moderator">>, <<"support">>]).
|
||||
|
||||
%% ========== REFRESH TOKEN ==========
|
||||
|
||||
-spec generate_refresh_token(UserId :: binary()) -> {binary(), calendar:datetime()}.
|
||||
|
||||
Reference in New Issue
Block a user