Corrected authenticate function calls.
parent
73d98ed56f
commit
29cb046e3d
|
@ -97,7 +97,7 @@ forbidden(Req, State) ->
|
|||
#{dudeauth := Auth, dudename := User} = cowboy_req:match_cookies([dudeauth,
|
||||
dudename], Req),
|
||||
|
||||
case dudeswave_auth:authenticate(User, Auth) of
|
||||
case dudeswave_auth:authenticate(User, {cookie, Auth}) of
|
||||
{error, service_unavailable} -> exit(service_unavailable);
|
||||
true -> {false, Req, State};
|
||||
false -> {true, Req, State}
|
||||
|
@ -159,7 +159,7 @@ login(Req, State) ->
|
|||
{ok, Data, Req0} = cowboy_req:read_body(Req),
|
||||
#{<<"user">> := User, <<"password">> := Pass} = json:decode(Data),
|
||||
|
||||
case dudeswave_auth:authenticate(User, Pass) of
|
||||
case dudeswave_auth:authenticate(User, {password, Pass}) of
|
||||
{true, Cookie, Validity} ->
|
||||
Req1 = cowboy_req:set_resp_cookie(<<"dudeauth">>, Cookie, Req0,
|
||||
#{max_age => Validity}),
|
||||
|
|
Loading…
Reference in New Issue