fix(authn): quickly return when the password is absent in password-based authentication

This commit is contained in:
firest 2023-08-22 11:49:32 +08:00
parent 4e4c93a758
commit b0c5b447a4
6 changed files with 12 additions and 0 deletions

View File

@ -173,6 +173,8 @@ update(Config, _State) ->
authenticate(#{auth_method := _}, _) ->
ignore;
authenticate(#{password := undefined}, _) ->
{error, bad_username_or_password};
authenticate(
#{password := Password} = Credential,
#{

View File

@ -160,6 +160,8 @@ destroy(#{resource_id := ResourceId}) ->
authenticate(#{auth_method := _}, _) ->
ignore;
authenticate(#{password := undefined}, _) ->
{error, bad_username_or_password};
authenticate(
#{password := Password} = Credential,
#{

View File

@ -110,6 +110,8 @@ destroy(#{resource_id := ResourceId}) ->
authenticate(#{auth_method := _}, _) ->
ignore;
authenticate(#{password := undefined}, _) ->
{error, bad_username_or_password};
authenticate(
#{password := Password} = Credential,
#{

View File

@ -113,6 +113,8 @@ destroy(#{resource_id := ResourceId}) ->
authenticate(#{auth_method := _}, _) ->
ignore;
authenticate(#{password := undefined}, _) ->
{error, bad_username_or_password};
authenticate(
#{password := Password} = Credential,
#{

View File

@ -148,6 +148,8 @@ destroy(#{resource_id := ResourceId}) ->
authenticate(#{auth_method := _}, _) ->
ignore;
authenticate(#{password := undefined}, _) ->
{error, bad_username_or_password};
authenticate(
#{password := Password} = Credential,
#{

View File

@ -109,6 +109,8 @@ destroy(#{resource_id := ResourceId}) ->
authenticate(#{auth_method := _}, _) ->
ignore;
authenticate(#{password := undefined}, _) ->
{error, bad_username_or_password};
authenticate(
#{password := Password} = Credential,
#{