Author Topic: Module Login Problem  (Read 6914 times)

alucarddrac

  • Beginner
  • *
  • Posts: 3
Module Login Problem
« on: January 24, 2012, 06:39:02 am »
Hey Guys,

I'm having problem in using the mod_virtuemart_login. I am using v 1.1.9. I'm creating an eCommerce site with different login page using the mod_virtuemart_login and the user will go to login page by clicking the "Login Button" of the site.

My problem is in the login page that if the user entered the wrong username or password, the error message will appear to the page where I set to login redirect link. Is there a way that if ever the user will enter  the wrong access, it will not go to the login redirect link yet and the error message will only display in the login page.

And also how to change the login button in site to logout if ever the user already login.

Please help!




alucarddrac

  • Beginner
  • *
  • Posts: 3
Re: Module Login Problem
« Reply #1 on: January 25, 2012, 02:25:30 am »
Please anyone can give me some advice about my problem above.

FilipeRuivo

  • Jr. Member
  • **
  • Posts: 62
Re: Module Login Problem
« Reply #2 on: January 27, 2012, 16:35:40 pm »
Hello you can do this way.
It's not a very efficient way but will do the trick.

in components/com_user/controller.php around line 143
Code: [Select]
//preform the login action
$error = $mainframe->login($credentials, $options);

if(!JError::isError($error))
{
// Redirect if the return url is not registration or login
if ( ! $return ) {
$return = 'index.php?option=com_user';
}

$mainframe->redirect( $return );
}
else
{
// Facilitate third party login forms
if ( ! $return ) {
$return = 'index.php?option=com_user&view=login';
}

// Redirect to a login form
$mainframe->redirect( $return );

}

around line 161 add $return = ''; before the
Code: [Select]
// Redirect to a login form
$mainframe->redirect( $return );

Just like this
Code: [Select]
//preform the login action
$error = $mainframe->login($credentials, $options);

if(!JError::isError($error))
{
// Redirect if the return url is not registration or login
if ( ! $return ) {
$return = 'index.php?option=com_user';
}

$mainframe->redirect( $return );
}
else
{
// Facilitate third party login forms
if ( ! $return ) {
$return = 'index.php?option=com_user&view=login';
}

// Redirect to custom URL if login error
$return = '';

// Redirect to a login form
$mainframe->redirect( $return );
}

Note:
empty $return=''; (like in the example) will redirect to home page
if you want to redirect to other page lets say virtuemart page $return = JRoute::_('index.php?option=com_virtuemart&Itemid=2');
change the Itemid to the corresponding id of the menu