Skip to content

Commit a4f0dbe

Browse files
author
Marius Burkard
committed
Ported Merge Request !304 from master
1 parent 22c9109 commit a4f0dbe

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

interface/web/login/index.php

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,8 @@
157157
$user = false;
158158
if($mailuser) {
159159
$saved_password = stripslashes($mailuser['password']);
160-
$salt = '$1$'.substr($saved_password, 3, 8).'$';
161160
//* Check if mailuser password is correct
162-
if(crypt(stripslashes($password), $salt) == $saved_password) {
161+
if(crypt(stripslashes($password), $saved_password) == $saved_password) {
163162
//* we build a fake user here which has access to the mailuser module only and userid 0
164163
$user = array();
165164
$user['userid'] = 0;
@@ -182,22 +181,15 @@
182181
$user = $app->db->queryOneRecord($sql, $username);
183182
if($user) {
184183
$saved_password = stripslashes($user['passwort']);
185-
if(substr($saved_password, 0, 3) == '$1$') {
186-
//* The password is crypt-md5 encrypted
187-
$salt = '$1$'.substr($saved_password, 3, 8).'$';
188-
if(crypt(stripslashes($password), $salt) != $saved_password) {
189-
$user = false;
190-
}
191-
} elseif(substr($saved_password, 0, 3) == '$5$') {
192-
//* The password is crypt-sha256 encrypted
193-
$salt = '$5$'.substr($saved_password, 3, 16).'$';
194-
if(crypt(stripslashes($password), $salt) != $saved_password) {
184+
if(substr($saved_password, 0, 1) == '$') {
185+
//* The password is encrypted with crypt
186+
if(crypt(stripslashes($password), $saved_password) != $saved_password) {
195187
$user = false;
196188
}
197189
} else {
198-
//* The password is md5 encrypted
190+
//* The password is md5 encrypted
199191
if(md5($password) != $saved_password) {
200-
$user = false;
192+
$user = false;
201193
}
202194
}
203195
} else {

0 commit comments

Comments
 (0)