summaryrefslogtreecommitdiff
path: root/lib/JWebmail/Plugin/Helper.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/JWebmail/Plugin/Helper.pm')
-rw-r--r--lib/JWebmail/Plugin/Helper.pm5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/JWebmail/Plugin/Helper.pm b/lib/JWebmail/Plugin/Helper.pm
index 8323a61..ad5c8ad 100644
--- a/lib/JWebmail/Plugin/Helper.pm
+++ b/lib/JWebmail/Plugin/Helper.pm
@@ -178,8 +178,9 @@ sub session_passwd {
if (length $passwd < 20) {
$passwd .= "\n" . ' ' x (20 - length($passwd) - 1);
}
- my $rand_bytes = _rand_data(length $passwd);
- $c->s3d(S_PASSWD, b64_encode(encode('UTF-8', $passwd) ^ $rand_bytes, ''));
+ my $passwd_utf8 = encode('UTF-8', $passwd);
+ my $rand_bytes = _rand_data(length $passwd_utf8);
+ $c->s3d(S_PASSWD, b64_encode($passwd_utf8 ^ $rand_bytes, ''));
$c->session(S_OTP_S3D_PW, b64_encode($rand_bytes, ''));
}
else {