add function to validate different password-hashes and update them to the currently set hash if login successfull and hash differs (unimplemented yet because of required db-updates which are hold back until 0.9.33-rc2), refs #1289

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2015-01-27 11:09:27 +01:00
parent 9d008efabc
commit 7b8341d826
2 changed files with 86 additions and 4 deletions

View File

@@ -19,8 +19,6 @@
/**
* Make crypted password from clear text password
* @param string Password to be crypted
* @return string encrypted password
*
* @author Michal Wojcik <m.wojcik@sonet3.pl>
* @author Michael Kaufmann <mkaufmann@nutime.de>
@@ -29,12 +27,16 @@
* 0 - default crypt (depenend on system configuration)
* 1 - MD5 $1$
* 2 - BLOWFISH $2a$ | $2y$07$ (on php 5.3.7+)
* 3 - SHA-256 $5$
* 3 - SHA-256 $5$ (default)
* 4 - SHA-512 $6$
*
* @param string $password Password to be crypted
*
* @return string encrypted password
*/
function makeCryptPassword ($password) {
$type = Settings::Get('system.passwordcryptfunc') !== null ? (int)Settings::Get('system.passwordcryptfunc') : 1;
$type = Settings::Get('system.passwordcryptfunc') !== null ? (int)Settings::Get('system.passwordcryptfunc') : 3;
switch ($type) {
case 0: