|
@@ -350,7 +350,7 @@ handle_call({lookup_chain, ID}, _From, State) ->
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
handle_call({create_authenticator, ChainID, #{name := Name} = Config}, _From, State) ->
|
|
handle_call({create_authenticator, ChainID, #{name := Name} = Config}, _From, State) ->
|
|
|
- UpdateFun =
|
|
|
|
|
|
|
+ UpdateFun =
|
|
|
fun(#chain{authenticators = Authenticators} = Chain) ->
|
|
fun(#chain{authenticators = Authenticators} = Chain) ->
|
|
|
case lists:keymember(Name, 2, Authenticators) of
|
|
case lists:keymember(Name, 2, Authenticators) of
|
|
|
true ->
|
|
true ->
|
|
@@ -374,7 +374,7 @@ handle_call({create_authenticator, ChainID, #{name := Name} = Config}, _From, St
|
|
|
reply(Reply, State);
|
|
reply(Reply, State);
|
|
|
|
|
|
|
|
handle_call({delete_authenticator, ChainID, AuthenticatorID}, _From, State) ->
|
|
handle_call({delete_authenticator, ChainID, AuthenticatorID}, _From, State) ->
|
|
|
- UpdateFun =
|
|
|
|
|
|
|
+ UpdateFun =
|
|
|
fun(#chain{authenticators = Authenticators} = Chain) ->
|
|
fun(#chain{authenticators = Authenticators} = Chain) ->
|
|
|
case lists:keytake(AuthenticatorID, 1, Authenticators) of
|
|
case lists:keytake(AuthenticatorID, 1, Authenticators) of
|
|
|
false ->
|
|
false ->
|
|
@@ -397,7 +397,7 @@ handle_call({update_or_create_authenticator, ChainID, AuthenticatorID, Config},
|
|
|
reply(Reply, State);
|
|
reply(Reply, State);
|
|
|
|
|
|
|
|
handle_call({move_authenticator, ChainID, AuthenticatorID, Position}, _From, State) ->
|
|
handle_call({move_authenticator, ChainID, AuthenticatorID, Position}, _From, State) ->
|
|
|
- UpdateFun =
|
|
|
|
|
|
|
+ UpdateFun =
|
|
|
fun(#chain{authenticators = Authenticators} = Chain) ->
|
|
fun(#chain{authenticators = Authenticators} = Chain) ->
|
|
|
case do_move_authenticator(AuthenticatorID, Authenticators, Position) of
|
|
case do_move_authenticator(AuthenticatorID, Authenticators, Position) of
|
|
|
{ok, NAuthenticators} ->
|
|
{ok, NAuthenticators} ->
|
|
@@ -524,7 +524,7 @@ do_delete_authenticator(#authenticator{provider = Provider, state = State}) ->
|
|
|
ok.
|
|
ok.
|
|
|
|
|
|
|
|
update_or_create_authenticator(ChainID, AuthenticatorID, #{name := NewName} = Config, CreateWhenNotFound) ->
|
|
update_or_create_authenticator(ChainID, AuthenticatorID, #{name := NewName} = Config, CreateWhenNotFound) ->
|
|
|
- UpdateFun =
|
|
|
|
|
|
|
+ UpdateFun =
|
|
|
fun(#chain{authenticators = Authenticators} = Chain) ->
|
|
fun(#chain{authenticators = Authenticators} = Chain) ->
|
|
|
case lists:keytake(AuthenticatorID, 1, Authenticators) of
|
|
case lists:keytake(AuthenticatorID, 1, Authenticators) of
|
|
|
false ->
|
|
false ->
|
|
@@ -586,7 +586,7 @@ update_or_create_authenticator(ChainID, AuthenticatorID, #{name := NewName} = Co
|
|
|
end
|
|
end
|
|
|
end,
|
|
end,
|
|
|
update_chain(ChainID, UpdateFun).
|
|
update_chain(ChainID, UpdateFun).
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
replace_authenticator(ID, #authenticator{name = Name} = Authenticator, Authenticators) ->
|
|
replace_authenticator(ID, #authenticator{name = Name} = Authenticator, Authenticators) ->
|
|
|
lists:keyreplace(ID, 1, Authenticators, {ID, Name, Authenticator}).
|
|
lists:keyreplace(ID, 1, Authenticators, {ID, Name, Authenticator}).
|
|
|
|
|
|