Jump to content

Redirect failed login back to listing details page.


Kurtis Houser

Recommended Posts

A failed login on the UserProfiles Signup page redirects back to the page.

 

I'd like failed logins on a listing detail page to redirect back to itself as well.

 

I've managed to get it working by replacing some of the code in elements/login.thtml with some of the code from userprofiles/account/login_form-joomla.thtml.

 

The login form now looks like this:

<form action="<?php echo $return_url;?>" method="post" name="jrLogin" id="jr_loginForm" style="margin-top:10px;">

    <input id="jr-username" type="text" name="username" placeholder="<?php __t("Username");?>" size="10" />

    <input id="jr-password" type="password" name="password" placeholder="<?php __t("Password");?>" size="10" />

    <input type="submit" name="Submit" class="jrButton jrLogin" value="<?php __t("Submit");?>" />

    <input type="hidden" name="option" value="com_jreviews" />

    <input type="hidden" name="data[controller]" value="userprofiles_users" />

    <input type="hidden" name="data[action]" value="login" />

    <input type="hidden" name="return" value="<?php echo $return_url_encoded; ?>" />

    <input type="hidden" name="return_fail" value="<?php echo $return_url_encoded; ?>" />

  <?php echo cmsFramework::getTokenInput();?>

</form>

Is this the best/proper way to do it? I noticed an overridden login() function in framework.php that utilizes the "return_fail" value. It would probably be nice if those without the UserProfiles add-on could do this as well. Or can they?

 

Thanks,

 

Kurtis

 

 

Link to comment
×
×
  • Create New...