if (isset($_POST['submit'])) { $password = isset($_POST['password']) ? trim(strip_tags($_POST['password'])) : null; $password_confirm = isset($_POST['password_confirm']) ? trim(strip_tags($_POST['password_confirm'])) : null; // validation if (is_null($password) || strlen($password) < 6) { Message::register(new Message(Message::DANGER, i18n(array('en' => 'Password needs to be more than 6 characters. Please try again', 'zh' => '密码至少需要6位。请重试')))); HTML::forwardBackToReferer(); } else { if ($password != $password_confirm) { Message::register(new Message(Message::DANGER, i18n(array('en' => 'Password and confirmed password don\'t match. Please try again', 'zh' => '密码和确认密码不符。 请重试')))); HTML::forwardBackToReferer(); } } // success $user->putPassword($password); $user->save(); Message::register(new Message(Message::SUCCESS, i18n(array('en' => 'Your password has been successfully updated. You may sign in below', 'zh' => '您的密码已经成功更新了。您现在可以登录了')))); HTML::forward('users'); } // override this call if "site" module has the override controller $override_controller = MODULESROOT . '/site/controllers/siteuser/forget_password_reset.php'; if (is_file($override_controller)) { require $override_controller; exit; } // default $html = new HTML(); $html->renderOut('core/backend/single_form_header', array('title' => i18n(array('en' => 'Reset your password', 'zh' => '重置您的密码')))); echo SiteUser::renderPasswordResetForm(); $html->renderOut('core/backend/single_form_footer', array('extra' => '<div style="text-align: center;"><small class="signup"><a href="' . uri('users') . '">' . i18n(array('en' => 'go back to login', 'zh' => '返回登录界面')) . '</a></small></div>')); exit;