/** * 检查密码强度 */ public function checkpwdStrongAction() { $pwd = $this->getInput('pwd', 'post'); $this->addMessage(PwUserHelper::checkPwdStrong($pwd), 'rank'); $this->showMessage(); }
public function checkPwdStrongAction() { $returnData = array("success" => true, "data" => "符合要求"); $pwd = $this->getInput('pwd', 'post'); $rank = PwUserHelper::checkPwdStrong($pwd); $message = ""; switch ($rank) { case 1: $message = "非常弱"; break; case 2: $message = "弱"; break; case 3: $message = "中"; break; case 4: $message = "强"; break; } $result = "<span class='pwd_strength_" . $rank . "'" . ">" . $message . "</span>" . $message; $returnData['data'] = $result; print_r(json_encode($returnData)); die; }
/** * 密码校验 */ public function checkpwdAction() { $pwd = $this->getInput('pwd', 'post'); $result = PwUserValidator::isPwdValid($pwd, $this->loginUser->username); if ($result instanceof PwError) { $this->showError($result->getError()); } $this->addMessage(PwUserHelper::checkPwdStrong($pwd), 'rank'); $this->showMessage(); }