From: Alan Knowles Date: Fri, 7 Dec 2018 02:28:31 +0000 (+0800) Subject: Pman/Login.php X-Git-Url: http://git.roojs.org/?p=Pman.Base;a=commitdiff_plain;h=c5f869a56dc8bdd9228845aa2b53b0c585d2414b Pman/Login.php --- diff --git a/Pman/Login.php b/Pman/Login.php index 5feeb62..b99f8ea 100644 --- a/Pman/Login.php +++ b/Pman/Login.php @@ -436,6 +436,38 @@ class Pman_Login extends Pman } + + function resetPassword($id,$t, $key) + { + + $au = $this->getAuthUser(); + if ($au) { + return "Already Logged in - no need to use Password Reset"; + } + + $u = DB_DataObject::factory('core_person'); + //$u->company_id = $this->company->id; + $u->active = 1; + if (!$u->get($id) || !strlen($u->passwd)) { + return "invalid id"; + } + + // validate key.. + if ($key != $u->genPassKey($t)) { + return "invalid key"; + } + $uu = clone($u); + $u->no_reset_sent = 0; + $u->update($uu); + + if ($t < strtotime("NOW - 1 DAY")) { + return "expired"; + } + $this->showNewPass = implode("/", array($id,$t,$key)); + return false; + } + + function changePassword($r) { $au = $this->getAuthUser();