• 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: Created custom login form - won't post

Created custom login form - won't post 10 years 5 days ago #31514

  • blemker
  • blemker's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 3
  • Thank you received: 1
I created a custom login form using the code previously posted. I need to capture the login and e-mail address used (the extra field). It doesn't appear that it is keeping any submissions. How can I correct that?

Here's the code:
In form layout:
//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);
}

in Post
//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']['username'];
$data['password'] = $_POST['form']['password'];
$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("username");
	$invalid[] = RSFormProHelper::getComponentId("password");
}
The administrator has disabled public write access.
The following user(s) said Thank You: glenanPL

Created custom login form - won't post 10 years 5 days ago #31534

  • andreic
  • andreic's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 745
  • Thank you received: 66
Hello,

This is most likely caused by the redirect that is being performed in the second script (the one placed in the "Scripts called on form process" field). Please try removing/commenting out the redirect script and test the functionality again.

More specifically you will need to replace
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("username");
	$invalid[] = RSFormProHelper::getComponentId("password");
}

with
if (true !== $app->login($data, $options)){
	//invalidate username and password field if the login data was not correct, or the action could not be performed
	$invalid[] = RSFormProHelper::getComponentId("username");
	$invalid[] = RSFormProHelper::getComponentId("password");
}
Please note: my help is not official customer support. To receive your support, submit a ticket by clicking here
Regards,
RSJoomla! Development Team
Last Edit: 10 years 5 days ago by andreic.
The administrator has disabled public write access.

Created custom login form - won't post 10 years 4 days ago #31547

  • blemker
  • blemker's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 3
  • Thank you received: 1
YES! This worked, thank you.
The administrator has disabled public write access.

Created custom login form - won't post 4 years 5 months ago #40873

Use:
1. Textbox
2. Password
3. Styled Checkbox or Checkbox

Script called on form process:

$app = JFactory::getApplication();
$username = $_POST;
$password = $_POST;
$remember = $_POST;
$app->login( array('username'=>$username,'password'=>$password,'remember' => $remember) );
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!