增加修改密码时的长度判断

This commit is contained in:
Li Jianxuan 2011-12-14 04:02:19 +00:00
parent d2f61f3db7
commit 57df77c11b
1 changed files with 17 additions and 4 deletions

View File

@ -75,6 +75,7 @@ class AccountController extends Zend_Controller_Action
$this->view->user = $rows; $this->view->user = $rows;
} }
} }
function saveoptAction() function saveoptAction()
{ {
$this->_helper->layout->disableLayout(); $this->_helper->layout->disableLayout();
@ -166,15 +167,27 @@ class AccountController extends Zend_Controller_Action
$match = "/[\"|'|\\\]/i"; $match = "/[\"|'|\\\]/i";
if(preg_match($match,$password) || preg_match($match,$password_new) || preg_match($match,$password_confirm) || $rows['password']!== md5($password)) if(preg_match($match,$password) || preg_match($match,$password_new) || preg_match($match,$password_confirm) || $rows['password']!== md5($password) || strlen($password_new)>20)
{ {
echo "The password you entered is incorrect.Please re-enter your password"; echo "The password you entered is incorrect.Please re-enter your password";
exit(); exit();
} }
if(strlen($password_new)>6)
{
echo "Your new password is too short";
exit();
}
if(strlen($password_new)>20)
{
echo "Your new password is too long";
exit();
}
if(md5($password_new) !== md5($password_confirm)) if(md5($password_new) !== md5($password_confirm))
{ {
echo ""; echo "Entered passwords differ from the another";
exit(); exit();
} }
@ -195,14 +208,14 @@ class AccountController extends Zend_Controller_Action
exit(); exit();
} }
} }
else else
{ {
exit(); exit();
} }
} } //saveopt ajax修改用户信息
function loginAction() function loginAction()
{ {
$form = new LoginForm(); $form = new LoginForm();