aboutsummaryrefslogtreecommitdiff
path: root/src/ejabberd_auth.erl
diff options
context:
space:
mode:
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>2017-04-29 11:48:57 +0300
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>2017-04-29 11:48:57 +0300
commit2b63d07329b2af63d63b14d237e63565f78e8018 (patch)
tree3a4b245b5d50cb4f54a6777d20e138efed105835 /src/ejabberd_auth.erl
parentFix elixir tests (diff)
parentDon't validate an option in ejabberd_config:get_option() functions (diff)
Merge branch 'new-option-validation'
Diffstat (limited to 'src/ejabberd_auth.erl')
-rw-r--r--src/ejabberd_auth.erl14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/ejabberd_auth.erl b/src/ejabberd_auth.erl
index 10acb8157..756fafcf6 100644
--- a/src/ejabberd_auth.erl
+++ b/src/ejabberd_auth.erl
@@ -44,7 +44,7 @@
get_password_s/2, get_password_with_authmodule/2,
is_user_exists/2, is_user_exists_in_other_modules/3,
remove_user/2, remove_user/3, plain_password_required/1,
- store_type/1, entropy/1, backend_type/1]).
+ store_type/1, entropy/1, backend_type/1, password_format/1]).
%% gen_server callbacks
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
terminate/2, code_change/3]).
@@ -497,6 +497,9 @@ backend_type(Mod) ->
_ -> Mod
end.
+password_format(LServer) ->
+ ejabberd_config:get_option({auth_password_format, LServer}, plain).
+
%%%----------------------------------------------------------------------
%%% Internal functions
%%%----------------------------------------------------------------------
@@ -508,8 +511,7 @@ auth_modules() ->
auth_modules(Server) ->
LServer = jid:nameprep(Server),
Default = ejabberd_config:default_db(LServer, ?MODULE),
- Methods = ejabberd_config:get_option(
- {auth_method, LServer}, opt_type(auth_method), [Default]),
+ Methods = ejabberd_config:get_option({auth_method, LServer}, [Default]),
[misc:binary_to_atom(<<"ejabberd_auth_",
(misc:atom_to_binary(M))/binary>>)
|| M <- Methods].
@@ -537,4 +539,8 @@ opt_type(auth_method) ->
lists:map(fun(M) -> ejabberd_config:v_db(?MODULE, M) end, V);
(V) -> [ejabberd_config:v_db(?MODULE, V)]
end;
-opt_type(_) -> [auth_method].
+opt_type(auth_password_format) ->
+ fun (plain) -> plain;
+ (scram) -> scram
+ end;
+opt_type(_) -> [auth_method, auth_password_format].