Forums
Auto Login and Generated password does not work.
Hi,
Did you set up Joomla to require Account Activation (in the Site Configuration)? Auto-Login will not work with this enabled, since you cannot logon until the account has been activated..
/Fredrik
Did you set up Joomla to require Account Activation (in the Site Configuration)? Auto-Login will not work with this enabled, since you cannot logon until the account has been activated..
/Fredrik
Hi again,
Just dug around in the plugin code, and it seems the auto-login feature will not work with automatically generated passwords. I think the following change should do the trick though (in com_chronocontact/plugins/cf_joomla_registrations.php around line 430):
Change that into this:
/Fredrik
Just dug around in the plugin code, and it seems the auto-login feature will not work with automatically generated passwords. I think the following change should do the trick though (in com_chronocontact/plugins/cf_joomla_registrations.php around line 430):
if ( $params->get('autologin') ) {
$credentials = array();
$credentials['username'] = $post['username'];
$credentials['password'] = JRequest::getVar($params->get('pass'), '', 'post', 'string', JREQUEST_ALLOWRAW);
$mainframe->login($credentials);
}
Change that into this:
if ( $params->get('autologin') ) {
$credentials = array();
$credentials['username'] = $post['username'];
$credentials['password'] = $post['password'];
$mainframe->login($credentials);
}
/Fredrik
Thanks for the code, but still not working.😑
Edit:
I got it working, instead of:
I changed it to:
Now i have one more question, how can i email the generated password to the user🤨
Edit:
I got it working, instead of:
$credentials['password'] = $post['password'];
I changed it to:
$credentials['password'] = $post['password2'];
Now i have one more question, how can i email the generated password to the user🤨
Ahh, my bad;
Tested this, and it seems to work ok.
/Fredrik
Tested this, and it seems to work ok.
if ( $params->get('autologin') ) {
$credentials = array();
$credentials['username'] = $post['username'];
$credentials['password'] = $post['password2'];
$mainframe->login($credentials);
}
/Fredrik
Yes, that's what i did, i have changed password with password2.
Did you read my other question?
In case not:
How do i email the generated password to the user🤨
Did you read my other question?
In case not:
How do i email the generated password to the user🤨
Oh, must have overlooked that question.
The email should be included in the standard Joomla user email, though there seems to be the same issue of using JRequest::getString() here aswell. Around line 402, you'll find something like this:
Change that to:
Hopefully, that should do the trick..
I'm not sure if this will work with any custom user emails though...
/Fredrik
The email should be included in the standard Joomla user email, though there seems to be the same issue of using JRequest::getString() here aswell. Around line 402, you'll find something like this:
$password = JRequest::getString($params->get('pass'), '', 'post');
Change that to:
$password = $post['password2'];
Hopefully, that should do the trick..
I'm not sure if this will work with any custom user emails though...
/Fredrik
I followed above message but I still do not get password sent, instead I get this:
You may now log in to http://www.mywebsite.com/ using the username and password you registered with.
Any ideas?
You may now log in to http://www.mywebsite.com/ using the username and password you registered with.
Any ideas?
Hi jhdesign,
Seems I lost track of this thread for a while.
To the issue though, if you did not setup your Joomla system to require User Activation, then the Joomla email template will not contain any activation link, username, or password. Enabling User Activation however blocks the auto-login (can't login until you've activated your account).
There is, however, an option to use a custom email template (uses one of the form's emails). This won't work out of the box, though.. You'll need to add support for a {user} and {pass} macro.
Locate these lines (around line 413):
Extend it like this:
Also make sure you add your {user} and {pass} macros to your email template..
/Fredrik
Edit:
Fixed two typos that managed to sneak into the code while writing the post..
Seems I lost track of this thread for a while.
To the issue though, if you did not setup your Joomla system to require User Activation, then the Joomla email template will not contain any activation link, username, or password. Enabling User Activation however blocks the auto-login (can't login until you've activated your account).
There is, however, an option to use a custom email template (uses one of the form's emails). This won't work out of the box, though.. You'll need to add support for a {user} and {pass} macro.
Locate these lines (around line 413):
$MyFormEmails->emails[$emailid - 1]->enabled = 1;
$MyFormEmails->emails[$emailid - 1]->template = str_replace("{vlink}", JURI::base()."index.php?option=com_user&task=activate&activation=".$user->get('activation'), $MyFormEmails->emails[$emailid - 1]->template;
$Myemail = array($MyFormEmails->emails[$emailid - 1]);
Extend it like this:
$MyFormEmails->emails[$emailid - 1]->enabled = 1;
$MyFormEmails->emails[$emailid - 1]->template = str_replace("{vlink}", JURI::base()."index.php?option=com_user&task=activate&activation=".$user->get('activation'), $MyFormEmails->emails[$emailid - 1]->template;
$MyFormEmails->emails[$emailid - 1]->template = str_replace("{user}", $post['username'], $MyFormEmails->emails[$emailid - 1]->template);
$MyFormEmails->emails[$emailid - 1]->template = str_replace("{pass}", $post['password2'], $MyFormEmails->emails[$emailid - 1]->template);
$Myemail = array($MyFormEmails->emails[$emailid - 1]);
Also make sure you add your {user} and {pass} macros to your email template..
/Fredrik
Edit:
Fixed two typos that managed to sneak into the code while writing the post..
This topic is locked and no more replies can be posted.