login
This commit is contained in:
parent
6fedab1e12
commit
50f2162968
|
@ -77,7 +77,14 @@ authorized(Req) ->
|
|||
undefined ->
|
||||
false;
|
||||
"Basic " ++ BasicAuth ->
|
||||
emqttd_auth:check(user_passwd(BasicAuth))
|
||||
{Username, Password} = user_passwd(BasicAuth),
|
||||
case emqttd_auth:login(#mqtt_client{username = Username}, Password) of
|
||||
ok ->
|
||||
true;
|
||||
{error, Reason} ->
|
||||
lager:error("HTTP Auth failure: username=~s, reason=~p", [Username, Reason]),
|
||||
false
|
||||
end
|
||||
end.
|
||||
|
||||
user_passwd(BasicAuth) ->
|
||||
|
|
Loading…
Reference in New Issue