|
157 | 157 | $user = false; |
158 | 158 | if($mailuser) { |
159 | 159 | $saved_password = stripslashes($mailuser['password']); |
160 | | - $salt = '$1$'.substr($saved_password, 3, 8).'$'; |
161 | 160 | //* Check if mailuser password is correct |
162 | | - if(crypt(stripslashes($password), $salt) == $saved_password) { |
| 161 | + if(crypt(stripslashes($password), $saved_password) == $saved_password) { |
163 | 162 | //* we build a fake user here which has access to the mailuser module only and userid 0 |
164 | 163 | $user = array(); |
165 | 164 | $user['userid'] = 0; |
|
182 | 181 | $user = $app->db->queryOneRecord($sql, $username); |
183 | 182 | if($user) { |
184 | 183 | $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) { |
195 | 187 | $user = false; |
196 | 188 | } |
197 | 189 | } else { |
198 | | - //* The password is md5 encrypted |
| 190 | + //* The password is md5 encrypted |
199 | 191 | if(md5($password) != $saved_password) { |
200 | | - $user = false; |
| 192 | + $user = false; |
201 | 193 | } |
202 | 194 | } |
203 | 195 | } else { |
|
0 commit comments