|
@@ -6,6 +6,7 @@ local saslprep = require "util.encodings".stringprep.saslprep;
|
6
|
6
|
local secure_equals = require "util.hashes".equals;
|
7
|
7
|
|
8
|
8
|
local shared_secret = module:get_option_string('shared_secret');
|
|
9
|
+local shared_secret_prev = module:get_option_string('shared_secret_prev');
|
9
|
10
|
if shared_secret == nil then
|
10
|
11
|
module:log('error', 'No shared_secret specified. No secret to operate on!');
|
11
|
12
|
return;
|
|
@@ -24,6 +25,9 @@ function provider.test_password(username, password)
|
24
|
25
|
|
25
|
26
|
if secure_equals(password, saslprep(shared_secret)) then
|
26
|
27
|
return true;
|
|
28
|
+ elseif (shared_secret_prev ~= nil and secure_equals(password, saslprep(shared_secret_prev))) then
|
|
29
|
+ module:log("info", "Accepting login using previous shared secret, username=%s", username);
|
|
30
|
+ return true;
|
27
|
31
|
else
|
28
|
32
|
return nil, "Auth failed. Invalid username or password.";
|
29
|
33
|
end
|