remindPasswdAction() // : $this->sendAlreadyLoggedIn() // ; $task = V::get('_task', '', $_GET); switch ($task) { case 'rp': return $this->rpAction(); default: return $this->remindPasswdAction(); } } function remindPasswdAction() { if ('remind' == V::get('_postTask', '', $_POST)) { try { $email = V::get('ADM_ACCOUNT', '', $_POST); $this->remindPasswd($email); } catch (Exception $e) { $this->sendRemindPasswdForm([ 'errors' => [ $e->getMessage() ] ]); } return $this->sendRemindPasswdSent(); } $this->sendRemindPasswdForm(); exit; } function remindPasswd($email) { if (empty($email)) throw new Exception("Proszę podać adres email"); if (!filter_var($email, FILTER_VALIDATE_EMAIL)) throw new Exception("Proszę podać poprawny adres email"); // BŁĄD: Brak zarejestrowanego użytkownika o wprowadzonym adresie email. Theme_Auth_panel_biall_net::fetchUser($email); $remindKey = Theme_Auth_panel_biall_net::generateRemindKey($email); $resetLink = $this->getLink('rp', [ 'login' => $email, 'key' => $remindKey ]); Theme_Auth_panel_biall_net::sendRemindPasswd($email, $resetLink); } function rpAction() { if ('set' == V::get('_postTask', '', $_POST)) { try { $email = V::get('ADM_ACCOUNT', '', $_POST); $remindKey = V::get('REMIND_KEY', '', $_POST); $newPasswd = V::get('ADM_PASSWD', '', $_POST); Theme_Auth_panel_biall_net::setPasswd($email, $newPasswd, $remindKey); } catch (Exception $e) { $this->sendNewPasswdForm(array_merge($_GET, [ 'errors' => [ $e->getMessage() ] ])); } return $this->sendRemindPasswdSet(); } $this->sendNewPasswdForm($_GET); exit; } function sendNewPasswdForm($args = []) { UI::gora(); UI::tryCatchView([ $this, 'setNewPassForm' ], [ 'args' => $args ]); UI::dol(); exit; } function sendRemindPasswdSet() { UI::gora(); Theme::remindNewPasswordSet($data = [ 'msg' => "Twoje nowe hasło zostało zapisane." ]); UI::dol(); exit; } function setNewPassForm($args) { $login = V::get('login', '', $args); $remindKey = V::get('key', '', $args); if (empty($login)) throw new Exception("Missing login!"); if (empty($remindKey)) throw new Exception("Missing key!"); Theme::remindSetNewPassword($args); } function sendRemindPasswdForm($data = []) { UI::gora(); Theme::remind($data); UI::dol(); exit; } function sendRemindPasswdSent() { UI::gora(); Theme::remindSent($data = []); UI::dol(); exit; } function sendAlreadyLoggedIn() { UI::gora(); // Theme::top(); echo UI::h('h1', [], "TODO: Already logged in"); UI::dol(); exit; } function defaultAction() { UI::gora(); // Theme::top(); echo '