Skip to content

Commit

Permalink
KCRO-17: skip some routines during user creation if there were errors (
Browse files Browse the repository at this point in the history
  • Loading branch information
lazedo authored Mar 5, 2020
1 parent bebc9b2 commit 9770c5e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion applications/crossbar/src/modules/cb_users.erl
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,9 @@ maybe_import_credentials(_UserId, Context) ->

-spec maybe_set_identity_secret(kz_term:api_ne_binary(), cb_context:context()) -> cb_context:context().
maybe_set_identity_secret(_UserId, Context) ->
case crossbar_auth:has_identity_secret(Context) of
case crossbar_auth:has_identity_secret(Context)
orelse cb_context:has_errors(Context)
of
'true' -> Context;
'false' ->
lager:debug("initalizing identity secret"),
Expand Down Expand Up @@ -683,6 +685,13 @@ on_successful_validation(UserId, Context) ->

-spec maybe_rehash_creds(kz_term:api_binary(), cb_context:context()) -> cb_context:context().
maybe_rehash_creds(_UserId, Context) ->
case cb_context:has_errors(Context) of
'false' -> rehash_creds(Context);
'true' -> Context
end.

-spec rehash_creds(cb_context:context()) -> cb_context:context().
rehash_creds(Context) ->
JObj = cb_context:doc(Context),
Username = kzd_users:username(JObj),
CurrentJObj = cb_context:fetch(Context, 'db_doc', kz_json:new()),
Expand Down

0 comments on commit 9770c5e

Please sign in to comment.