livehelperchat icon indicating copy to clipboard operation
livehelperchat copied to clipboard

forget password not working

Open xMr110 opened this issue 3 years ago • 2 comments

Hey,

Password reminder don't work on SMTP ,

i have tested the test mail function and it's working

but when i try to reset password mail was not sent

i have built a work around and created new function that made this working

i just want to check if there is a bug with it

xMr110 avatar Sep 13 '22 04:09 xMr110

Are you sure to not have more operators with the same email address?

PeopleInside avatar Sep 13 '22 08:09 PeopleInside

yea , i am sure i have only 2 operators and they have different emails

i have modified the forget password function into this and added sendResetMail function in erLhcoreClassChatMail class

after this the reset password work perfectly using SMTP in my domain

if (($userID = erLhcoreClassModelUser::fetchUserByEmail($form->Email)) !== false) {

		$host = erLhcoreClassSystem::getHost();

		$adminEmail = erConfigClassLhConfig::getInstance()->getSetting( 'site', 'site_admin_email' );

		$UserData = erLhcoreClassUser::getSession()->load( 'erLhcoreClassModelUser', $userID );

		$hash = erLhcoreClassModelForgotPassword::randomPassword(40);

		erLhcoreClassModelForgotPassword::setRemindHash($UserData->id,$hash);


		$Subject = erTranslationClassLhTranslation::getInstance()->getTranslation('user/forgotpassword','Password remind');
		// HTML body
		$body  = erTranslationClassLhTranslation::getInstance()->getTranslation('user/forgotpassword','Click this link and You will be able to change a password').' </br><a href="' . $host . erLhcoreClassDesign::baseurl('user/remindpassword').'/'.$hash.'">Restore password</a>';
		// Plain text body
		$text_body  = erTranslationClassLhTranslation::getInstance()->getTranslation('user/forgotpassword','Click this link and You will be able to change a password').' - ' . $host . erLhcoreClassDesign::baseurl('user/remindpassword').'/'.$hash;

        erLhcoreClassChatMail::sendResetMail($UserData,$text_body,$Subject);

		$tpl = erLhcoreClassTemplate::getInstance( 'lhuser/forgotpasswordsent.tpl.php');

	} else {
        $tpl = erLhcoreClassTemplate::getInstance( 'lhuser/forgotpasswordsent.tpl.php');
	}

xMr110 avatar Sep 13 '22 10:09 xMr110