나는 최적의 기능을하지 못하는 비밀번호 재설정 구성 요소가있는 joomla 1.5 사이트를 상속 받았습니다. ATM 사용자가 입력 한 전자 메일로 암호 재설정을 보낼 수 있지만 구성 요소에는 전자 메일이 유효한지 확인하기 위해 기존 사용자를 확인하는 기능이 없습니다. 나는 PHP에 익숙하지 않기 때문에 if 문을 추가로 소개하는 방법을 100 % 확신 할 수는 없습니다.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
아니요, com_resetpassword 폴더에 있습니다. – juneuprising