Software / code / prosody
Comparison
plugins/mod_saslauth.lua @ 4361:605045b77bc6
mod_saslauth: Fire authentication-success and authentication-failure events (thanks scitor)
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Mon, 29 Aug 2011 12:01:42 -0400 |
| parent | 4078:05a58497a903 |
| child | 4392:d2a7a44d68c5 |
comparison
equal
deleted
inserted
replaced
| 4360:a993a4a2ea0a | 4361:605045b77bc6 |
|---|---|
| 46 return reply; | 46 return reply; |
| 47 end | 47 end |
| 48 | 48 |
| 49 local function handle_status(session, status, ret, err_msg) | 49 local function handle_status(session, status, ret, err_msg) |
| 50 if status == "failure" then | 50 if status == "failure" then |
| 51 module:fire_event("authentication-failure", { session = session, condition = ret, text = err_msg }); | |
| 51 session.sasl_handler = session.sasl_handler:clean_clone(); | 52 session.sasl_handler = session.sasl_handler:clean_clone(); |
| 52 elseif status == "success" then | 53 elseif status == "success" then |
| 54 module:fire_event("authentication-success", { session = session }); | |
| 53 local username = nodeprep(session.sasl_handler.username); | 55 local username = nodeprep(session.sasl_handler.username); |
| 54 | 56 |
| 55 local ok, err = sm_make_authenticated(session, session.sasl_handler.username); | 57 local ok, err = sm_make_authenticated(session, session.sasl_handler.username); |
| 56 if ok then | 58 if ok then |
| 57 session.sasl_handler = nil; | 59 session.sasl_handler = nil; |