public static function login($user, $pass) { if (!self::isLoggedIn()) { $user = SystemUser::validate($user, $pass); if ($user != null) { if (null === self::$_system_session) { self::_create_session(); } self::$_system_session->setUser($user); return true; } } return false; }
<div class="frame"> <h1>Change password</h1> <form method="POST" action=""> <?php if (isset($_POST['action']) && 'change_password' === $_POST['action']) { if ($_POST['new_password'] !== $_POST['repeat_password']) { echo '<div class="msg msg-error">Password confirmation does not match.</div>'; } else { if (strlen($_POST['new_password']) < 10) { echo '<div class="msg msg-error">New password must be at least 10 chars length.</div>'; } else { if (SystemUser::validate(Session::getUser()->getLogin(), $_POST['old_password'])) { Session::getUser()->setPassword($_POST['new_password']); Session::closeAll(); Session::logout(); echo '<div class="msg msg-info">Password has been changed. Please, log in again.</div>'; } else { echo '<div class="msg msg-error">Wrong old password.</div>'; } } } } ?> <label>Old password<input type="password" name="old_password"></label> <label>New password<input type="password" name="new_password"></label>