function check_passwd($password) { /*bcrypt based password match*/ if (Passwd::cmp($password, $this->getPasswd())) { return true; } /*Fall back to MD5 && force a password reset if it matches*/ if (strlen($this->getPasswd()) && !strcmp($this->getPasswd(), MD5($password))) { $this->forcePasswdRest(); return true; } return false; }
function check_passwd($password, $autoupdate = true) { /*bcrypt based password match*/ if (Passwd::cmp($password, $this->getPasswd())) { return true; } //Fall back to MD5 if (!$password || strcmp($this->getPasswd(), MD5($password))) { return false; } //Password is a MD5 hash: rehash it (if enabled) otherwise force passwd change. $sql = 'UPDATE ' . STAFF_TABLE . ' SET passwd=' . db_input(Passwd::hash($password)) . ' WHERE staff_id=' . db_input($this->getId()); if (!$autoupdate || !db_query($sql)) { $this->forcePasswdRest(); } return true; }
function checkPassword($password, $autoupdate = true) { /*bcrypt based password match*/ if (Passwd::cmp($password, $this->get('passwd'))) { return true; } //Fall back to MD5 if (!$password || strcmp($this->get('passwd'), MD5($password))) { return false; } //Password is a MD5 hash: rehash it (if enabled) otherwise force passwd change. if ($autoupdate) { $this->set('passwd', Passwd::hash($password)); } if (!$autoupdate || !$this->save()) { $this->forcePasswdReset(); } return true; }