• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Creating user "Login Form"

Creating user "Login Form" 10 years 9 months ago #23830

  • lking
  • lking's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 24
Hello,

I would like to create a login form using RSForm Pro that allow user to login first then redirect them to another form to proceed on and I found a sample login form in the following link:

www.joomla-form.com/form-examples/form-scripts/10-login-form

Unfortunately, the above link for login form only will work in Joomla 1.6 and it doesn't work in version 2.5 and above (white/blank screen). I've been searching the forum and can't find any answer. Can anyone please help to solve this problem? Please explain which part of the codes need to be edited or changed.

Thanks
Last Edit: 10 years 9 months ago by lking.
The administrator has disabled public write access.

Creating user "Login Form" 10 years 9 months ago #23843

  • lking
  • lking's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 24
Can anyone please help.....?
The administrator has disabled public write access.

Creating user "Login Form" 10 years 8 months ago #24005

  • alexp
  • alexp's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 2253
  • Thank you received: 180
First of all, you will need a simple form that would need username and password fields. You can simply use a textbox and password field for the job (don't forget the submit button as well).

AS you might have guessed, you will need some coding knowledge to implement this. First of all, you will need a script similar to the following, within the PHP Scripts > Scripts called on form display area:
//get current user
$user = JFactory::getUser();
//verify if the user is logged in or not
if($user->id > 0){
	$app = JFactory::getApplication();
	$app->redirect('index.php?option=com_users&view=login');
}
else{
	$token = JHTML::_('form.token');
	$formLayout = str_replace('</form>', $token.'</form>', $formLayout);
}

Further to this, an additional script, placed within the PHP Scripts > Scripts called on form process area would be required:
//this will be the return URL once the login action was performed.
$return = JURI::root();
 
JSession::checkToken('post') or jexit(JText::_('JInvalid_Token'));
$app = JFactory::getApplication();
 
//construct login data
$data = array();
$data['return'] = $return;
$data['username'] = $_POST['form']['name of your username field'];
$data['password'] = $_POST['form']['name of your password field'];
$options = array();
 
if (true === $app->login($data, $options)){
	$app->redirect($return);
}
else{
	//invalidate username and password field if the login data was not correct, or the action could not be performed
	$invalid[] = RSFormProHelper::getComponentId("name of your username field");
	$invalid[] = RSFormProHelper::getComponentId("name of your password field");
}
Please note: my help is not official customer support. To receive your support, submit a ticket by clicking here
Regards,
RSJoomla! Development Team
The administrator has disabled public write access.
The following user(s) said Thank You: lking

Creating user "Login Form" 10 years 8 months ago #24013

  • lking
  • lking's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 24
Hello,

Thank you so much for helping. Everything is working perfectly, it just that the error message (incorrect username and password) won't show up on top when the form is assigned in a module position like position-20 in the template. It will only show "Please complete all required fields!" and "Invalid details" (in each field). Please advice if any changes can be done to allow showing up the error message like "Incorrect username and password". I'm trying to figure out.

Regards,
The administrator has disabled public write access.

Creating user "Login Form" 10 years 8 months ago #24036

  • alexp
  • alexp's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 2253
  • Thank you received: 180
A default error message should be displayed. Please change your template with one of the default ones and test again. Let me know how things go!
Please note: my help is not official customer support. To receive your support, submit a ticket by clicking here
Regards,
RSJoomla! Development Team
The administrator has disabled public write access.

Creating user "Login Form" 10 years 8 months ago #24117

  • lking
  • lking's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 24
Hello,

How do we make the form to be able to activate user account and display a short message like "Account Activation Successful" on top of the form once the account is activated? Just like a short script to detect if user account is activated, if yes, show message "ok". else display nothing and show the login form as in normal.

Thanks

Josh
The administrator has disabled public write access.

Creating user "Login Form" 10 years 4 months ago #25492

  • md8dev
  • md8dev's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 2
  • Thank you received: 2
Hello. This modification works in J3.1 but does not work in J3.2 stable. Could you tell me why?
The administrator has disabled public write access.

Creating user "Login Form" 10 years 2 months ago #26218

I have impleted this code and i'm getting "Invalid Token" all the time I cant go to the login page
The administrator has disabled public write access.

Creating user "Login Form" 10 years 2 months ago #26219

  • alexp
  • alexp's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 2253
  • Thank you received: 180
@kabelo.tsamaesi,

This can occur if the form token is not accutally present within the form. Have you added the script within the Scripts called on form display area ?
Please note: my help is not official customer support. To receive your support, submit a ticket by clicking here
Regards,
RSJoomla! Development Team
The administrator has disabled public write access.

Creating user "Login Form" 10 years 2 months ago #26220

Hi Alexp,

Yes I did,because what I want is to use joomla login component "com_users". I dont want to create another user registration component.
The administrator has disabled public write access.

Creating user "Login Form" 9 years 6 months ago #28837

  • mindjou
  • mindjou's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 6
how to replace joomla registration by RSform registration form?
Last Edit: 9 years 6 months ago by mindjou.
The administrator has disabled public write access.

Creating user "Login Form" 9 years 6 months ago #28845

  • cosmin.cristea
  • cosmin.cristea's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 756
  • Thank you received: 144
After creating a custom registration form, simply head over to Components > RSForm!Pro > Configuration > "Registration form" tab and select your form the dropdown.

More information can be found here:
http://www.rsjoomla.com/support/documentation/view-article/589-rsformpro-joomla-user-registration-plugin.html
My help is not official customer support. To receive your support, submit a ticket by clicking here
The administrator has disabled public write access.

Creating user "Login Form" 9 years 5 months ago #29076

  • modiac
  • modiac's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 7
Hello,

Have tried the script exactly for creating a login form
But when trying to login - its redirecting me to index.php?option=com_users&view=login page
Have tried many times - same result

Have checked on field name, scripts on form process and after form process, field name - rechecked - everything correct

However - When Logged in on site:- index.php?option=com_users&view=login page
, The script working well as redirecting to page given (in which redirection was set after login)

Pl suggest - is any modification to be done in the script

f($user->id > 0){
$app = JFactory::getApplication();
$app->redirect('index.php?option=com_users&view=login');
}
else{
$token = JHTML::_('form.token');
$formLayout = str_replace('</form>', $token.'</form>', $formLayout);
}
The administrator has disabled public write access.

Creating user "Login Form" 9 years 4 months ago #29294

I get the "Invalid Token" as well when trying to use on Joomla 3.3.6. There's a bug in the script code for the latest Joomla version.
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!