我已經繼承了一個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