Page 1 of 1

User RecoverPassword check

Posted: Fri Aug 30, 2024 12:23 am
by andyrav

Hi
when doing a recover password I would like the system to check if the users account is still active before sending a email and pop up a message to say "contact system admin" then return to login page when click on on

Tried this but didnt work

    // User RecoverPassword event
    public function userRecoverPassword($rs)
    {
        // Return false to abort
		if ($rs['Activated'] = 'N') {
			$this->ErrorMessage("Your account has not been activated.");
			 return FALSE;
		}
        return true;
    }

any ideas

thanks


Re: User RecoverPassword check

Posted: Fri Aug 30, 2024 9:22 am
by mobhar

Try this revised version:

// User RecoverPassword event
public function userRecoverPassword($rs)
{
    // Return false to abort
    if ($rs['Activated'] == 'N') {
        $this->setFailureMessage("Your account has not been activated.");
        return false;
    }
    return true;
}

Re: User RecoverPassword check

Posted: Tue Sep 03, 2024 12:01 am
by andyrav

using the following

public function userRecoverPassword($rs)
    {
        // Return false to abort
		if ($rs['Activated'] == 'N') {
			$this->setFailureMessage("Your account has not been activated.");
		}	else { 
			return true;
		}
    }

does not give me a error message i just get the following
You will receive password recovery instructions shortly if your email address is registered.
any ideas?

thanks


Re: User RecoverPassword check

Posted: Tue Sep 03, 2024 12:43 pm
by mobhar

You need to add return false; below the error message, see the code I posted above.


Re: User RecoverPassword check

Posted: Tue Sep 03, 2024 5:31 pm
by andyrav

Updated but would not show the message

if ($rs['Activated'] == 'N') {
	$this->setFailureMessage("Your account has not been activated.");
		return false;
}

Re: User RecoverPassword check

Posted: Tue Sep 03, 2024 5:32 pm
by andyrav

The function is working as it is not sending the email, just not displacing the message


Re: User RecoverPassword check

Posted: Tue Sep 03, 2024 10:16 pm
by arbei

Are you using modal dialog so the page is not redirected back to the login page like normal non-modal page?


Re: User RecoverPassword check

Posted: Wed Sep 04, 2024 5:15 am
by andyrav

Tired both. Nether work. Would prefer model with a error message lf posslsible.
Thanks