public static function savePassword(\Rebond\Core\User\Model $user) { Util\Log::log(Util\Error::PASSWORD_CHANGE, $user->getId(), __FILE__, __LINE__); $db = new Util\Data(); $query = 'UPDATE core_user SET password = ?, modified_date = ? WHERE id = ?'; return $db->execute($query, [$user->getPassword(), Util\Format::date(time(), 'sqlDatetime'), $user->getId()]); }
public static function signOut(\Rebond\Core\User\Model $user) { Data::deleteSecure($user->getId()); setcookie('signedUser', '', time() - 3600, '/', Util\Nav::removePort(\Rebond\Config::getPath('siteUrl'))); session_destroy(); session_write_close(); header('Location: /'); exit; }
public static function resetPassword($siteTitle, \Rebond\Core\User\Model $user) { $userSecure = \Rebond\Core\UserSecurity\Service::saveSecure($user->getId(), \Rebond\Core\UserSecurity\Model::RESET); $tpl = new Util\Template(Util\Template::SITE, ['mail']); $tpl->set('url', \Rebond\Config::getPath('siteUrl')); $tpl->set('site', $siteTitle); $tpl->set('item', $user); $tpl->set('reset', $userSecure->getSecure()); $tplMail = new Util\Template(Util\Template::SITE, ['mail']); $tplMail->set('title', Util\Lang::lang('resetPassword')); $tplMail->set('site', $siteTitle); $tplMail->set('url', \Rebond\Config::getPath('siteUrl')); $tplMail->set('layout', $tpl->render('reset-password')); $message = \Swift_Message::newInstance()->setContentType('text/html')->setSubject($siteTitle . ' - ' . Util\Lang::lang('resetPassword'))->setFrom(\Rebond\Config::getMail('email'))->setTo($user->getEmail())->setBody($tplMail->render('tpl-default')); return Util\Mail::send($message); }
public static function isAuth(\Rebond\Core\User\Model $user) { return isset($user) && $user->getId() > 0; }