atom_to_list(Username)
This commit is contained in:
parent
816827e1ee
commit
76851e58fb
|
@ -46,7 +46,7 @@
|
||||||
%% Authetication. Anonymous Default
|
%% Authetication. Anonymous Default
|
||||||
{auth, [
|
{auth, [
|
||||||
%% Authentication with username, password
|
%% Authentication with username, password
|
||||||
%{username, []},
|
{username, [{test, "password"}, {"test1", "password1"}]},
|
||||||
|
|
||||||
%% Authentication with clientid
|
%% Authentication with clientid
|
||||||
%{clientid, [{password, no}, {file, "etc/clients.config"}]},
|
%{clientid, [{password, no}, {file, "etc/clients.config"}]},
|
||||||
|
|
|
@ -77,6 +77,9 @@ add_user(Username, Password) ->
|
||||||
User = #?AUTH_USERNAME_TAB{username = Username, password = hash(Password)},
|
User = #?AUTH_USERNAME_TAB{username = Username, password = hash(Password)},
|
||||||
ret(mnesia:transaction(fun mnesia:write/1, [User])).
|
ret(mnesia:transaction(fun mnesia:write/1, [User])).
|
||||||
|
|
||||||
|
add_default_user(Username, Password) when is_atom(Username) ->
|
||||||
|
add_default_user(atom_to_list(Username), Password);
|
||||||
|
|
||||||
add_default_user(Username, Password) ->
|
add_default_user(Username, Password) ->
|
||||||
add_user(iolist_to_binary(Username), iolist_to_binary(Password)).
|
add_user(iolist_to_binary(Username), iolist_to_binary(Password)).
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue