增加了登录的验证码验证机制
This commit is contained in:
parent
1f804a114d
commit
aa2bf442dc
|
@ -349,6 +349,10 @@ class AccountController extends Zend_Controller_Action
|
||||||
$this->messenger->addMessage('登录失败,请检查您的用户名和密码。');
|
$this->messenger->addMessage('登录失败,请检查您的用户名和密码。');
|
||||||
} else $success=true;
|
} else $success=true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->messenger->addMessage('登录失败,验证码错误。');
|
||||||
|
}
|
||||||
|
|
||||||
if(!$success) {
|
if(!$success) {
|
||||||
$flashMessenger = $this->_helper->getHelper('FlashMessenger');
|
$flashMessenger = $this->_helper->getHelper('FlashMessenger');
|
||||||
|
@ -520,6 +524,30 @@ class AccountController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}// function fetchpwdAction()
|
||||||
|
|
||||||
|
function validateAction(){
|
||||||
|
|
||||||
|
$this->_helper->layout->disableLayout();
|
||||||
|
$this->_helper->viewRenderer->setNoRender();
|
||||||
|
|
||||||
|
$config = array(
|
||||||
|
'font_size' => 12,
|
||||||
|
'img_height' => 22,
|
||||||
|
'word_type' => (int)2, // 1:数字 2:英文 3:单词
|
||||||
|
'img_width' => 56,
|
||||||
|
'use_boder' => TRUE,
|
||||||
|
'font_file' => Zend_Registry::get('ROOT').'data/fonts/ggbi.ttf',
|
||||||
|
'wordlist_file' => 'words.txt',
|
||||||
|
'filter_type' => 5
|
||||||
|
);
|
||||||
|
include_once('files.php');
|
||||||
|
|
||||||
|
if (!files::echo_validate_image($config))
|
||||||
|
{
|
||||||
|
exit();
|
||||||
}
|
}
|
||||||
|
}//function validateAction()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
<img src="/images/Login_title.gif" alt="Login" />
|
<img src="/images/Login_title.gif" alt="Login" />
|
||||||
<?php echo $this->form;?>
|
<?php echo $this->form;?>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div id="tool">
|
<div id="tool">
|
||||||
<a href="/account/fetchpwd">Forgot Password?</a> <a href="/account/register">Register New User</a>
|
<a href="/account/fetchpwd">Forgot Password?</a> <a href="/account/register">Register New User</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -19,32 +19,53 @@ class LoginForm extends Zend_Form
|
||||||
|
|
||||||
$remember=new Zend_Form_Element_Checkbox('remember');
|
$remember=new Zend_Form_Element_Checkbox('remember');
|
||||||
$remember->setLabel('Remember me');
|
$remember->setLabel('Remember me');
|
||||||
|
|
||||||
$id = new Zend_Form_Element_Hidden('id');
|
$id = new Zend_Form_Element_Hidden('id');
|
||||||
|
|
||||||
$submit = new Zend_Form_Element_Submit('submit');
|
$submit = new Zend_Form_Element_Submit('submit');
|
||||||
$submit->setLabel('Login');
|
$submit->setLabel('Login');
|
||||||
$submit->setAttrib('id', 'submitbutton');
|
$submit->setAttrib('id', 'submitbutton');
|
||||||
|
|
||||||
$this->addElements(array($id, $username, $password, $remember, $submit));
|
$this->addElements(array($id, $username, $password, $remember));
|
||||||
$this->clearDecorators();
|
$this->clearDecorators();
|
||||||
$this->addDecorator('FormElements')
|
$this->addDecorator('FormElements')
|
||||||
->addDecorator('HtmlTag', array('tag' => '<ul>','class'=>'loginform'))
|
->addDecorator('HtmlTag', array('tag' => '<ul>','class'=>'loginform'))
|
||||||
->addDecorator('Form');
|
->addDecorator('Form');
|
||||||
|
|
||||||
$this->setElementDecorators(array(
|
$captcha = $this->addElement('captcha', 'captcha', array(
|
||||||
array('ViewHelper'),
|
'captcha' => array(
|
||||||
array('Errors'),
|
// First the type...
|
||||||
array('Description'),
|
'captcha' => 'Image',
|
||||||
array('Label', array('separator'=>' ')),
|
// Length of the word...
|
||||||
array('HtmlTag', array('tag' => 'li', 'class'=>'element-group')),
|
'wordLen' => 6,
|
||||||
|
'fontsize'=>16,
|
||||||
|
'width' => 100,
|
||||||
|
'height' => 38,
|
||||||
|
'dotNoiseLevel'=>2,
|
||||||
|
// Captcha timeout, 5 mins
|
||||||
|
'timeout' => 300,
|
||||||
|
// What font to use...
|
||||||
|
'font' => Zend_Registry::get('ROOT').'data/fonts/ggbi.ttf',
|
||||||
|
// Where to put the image
|
||||||
|
'imgDir' => $_SERVER["DOCUMENT_ROOT"].'/vdimg/',
|
||||||
|
// URL to the images
|
||||||
|
// This was bogus, here's how it should be... Sorry again :S
|
||||||
|
'imgUrl' => '/vdimg',
|
||||||
|
),
|
||||||
|
'label' => 'Validation code'
|
||||||
));
|
));
|
||||||
|
/*
|
||||||
// buttons do not need labels
|
// buttons do not need labels
|
||||||
$submit->setDecorators(array(
|
$submit->setDecorators(array(
|
||||||
array('ViewHelper'),
|
array('ViewHelper'),
|
||||||
array('Description'),
|
array('Description'),
|
||||||
array('HtmlTag', array('tag' => 'li', 'class'=>'submit-group')),
|
array('HtmlTag', array('tag' => 'dd', 'class'=>'submit-group')),
|
||||||
));
|
));
|
||||||
|
*/
|
||||||
|
|
||||||
|
$this->addElements(array($submit));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue