summaryrefslogtreecommitdiff
path: root/src/ejabberd_auth_riak.erl
diff options
context:
space:
mode:
authorAlexey Shchepin <alexey@process-one.net>2016-05-04 21:01:05 +0300
committerAlexey Shchepin <alexey@process-one.net>2016-05-05 15:51:58 +0300
commit0ea0ba3004282636c95bc86c3aac8755fcf7f8b1 (patch)
tree1330b6db70f7f6100c1997851faece5ad569391f /src/ejabberd_auth_riak.erl
parentMerge remote-tracking branch 'processone/pr/1088' (diff)
Update more SQL queries
Diffstat (limited to 'src/ejabberd_auth_riak.erl')
-rw-r--r--src/ejabberd_auth_riak.erl13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/ejabberd_auth_riak.erl b/src/ejabberd_auth_riak.erl
index c48b9441..c74f1b28 100644
--- a/src/ejabberd_auth_riak.erl
+++ b/src/ejabberd_auth_riak.erl
@@ -25,6 +25,8 @@
-module(ejabberd_auth_riak).
+-compile([{parse_transform, ejabberd_sql_pt}]).
+
-author('alexey@process-one.net').
-behaviour(ejabberd_auth).
@@ -42,6 +44,7 @@
-export([passwd_schema/0]).
-include("ejabberd.hrl").
+-include("ejabberd_sql_pt.hrl").
-record(passwd, {us = {<<"">>, <<"">>} :: {binary(), binary()} | '$1',
password = <<"">> :: binary() | scram() | '_'}).
@@ -290,12 +293,10 @@ is_password_scram_valid(Password, Scram) ->
export(_Server) ->
[{passwd,
fun(Host, #passwd{us = {LUser, LServer}, password = Password})
- when LServer == Host ->
- Username = ejabberd_sql:escape(LUser),
- Pass = ejabberd_sql:escape(Password),
- [[<<"delete from users where username='">>, Username, <<"';">>],
- [<<"insert into users(username, password) "
- "values ('">>, Username, <<"', '">>, Pass, <<"');">>]];
+ when LServer == Host ->
+ [?SQL("delete from users where username=%(LUser)s;"),
+ ?SQL("insert into users(username, password) "
+ "values (%(LUser)s, %(Password)s);")];
(_Host, _R) ->
[]
end}].