我已经继承了一个joomla 1.5站点,它有一个不能最佳运行的重置密码组件。 ATM我可以将密码重置发送到用户输入的电子邮件,但该组件缺少一个功能,可以检查现有用户以查看电子邮件是否有效。我对PHP很陌生,所以我不能100%确定如何引入额外的if语句。Joomla 1.5密码检查
这里是如何的呢到目前为止寻找:
public function submitemail() {
$db = JFactory::getDBO() ;
$requestedEmail = JRequest::getVar('emailaddr' , '') ;
$db->setQuery('select id , username, name, email from #__users where block = 0 and email = "'.$requestedEmail.'"') ;
if($user = $db->loadObject()) {
// Make sure the user isn't a Super Admin.
$juser = JFactory::getUser($user->id) ;
//joomla 1.6 and 1.5 check
if ($juser->authorize('core.admin') || $juser->usertype == 'Super Administrator') {
$this->setRedirect('index.php?option=com_resetpassword' , 'Email is not valid') ;
}
else {
$result = $this->sendPasswordResetEmail($user) ;
$this->setRedirect('index.php?option=com_resetpassword&layout=success' //, 'Please check your email and follow the instructions to reset your password '
) ;
}
}
else {
$this->setRedirect('index.php?option=com_resetpassword' );
}
}
我正好横跨相关的帖子,我发现这个片段。我将如何检查目前在我的数据库中的电子邮件地址与用户输入的电子邮件进行重置?
function validate()
{ jimport('joomla.mail.helper');
$valid = true;
if ($this->_data->email && !JMailHelper::isEmailAddress($this->_data->email))
{
$this->_app->enqueueMessage(JText::_('Invalid Email Address'),'error');
$valid = false;
}
return $valid;
}
从文件中的代码在'com_users'文件夹? – Lodder 2013-03-10 01:01:16
不,它来自com_resetpassword文件夹。 – juneuprising 2013-03-10 01:13:45