Skip to content

Commit

Permalink
MD5 PW Creation
Browse files Browse the repository at this point in the history
  • Loading branch information
ulrichblock committed Oct 16, 2013
1 parent c613ccc commit 787d28e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions web/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,13 @@
$userpassOld = passwordhash($username, $password);

// some systems do not care about security at all.
// In case we imported users from such insecure implementations
// In case we imported users from such insecure implementations we need to migrate to something safe
$md5Import = md5($password);

if ($userpassOld == $security) {
if ($userpassOld == $security or $md5Import == $security) {

$salt = md5(mt_rand() . date('Y-m-d H:i:s:u'));
$userpass = $userpassOld;
$userpass = ($userpassOld == $security) ? $userpassOld : $security;

$query = $sql->prepare("UPDATE `userdata` SET `security`=?,`salt`=? WHERE `id`=? LIMIT 1");
$query->execute(array(createHash($username, $password, $salt, $aeskey), $salt, $id));
Expand Down

0 comments on commit 787d28e

Please sign in to comment.