Jump to content

Custom failed login page


bucasia

Recommended Posts

Hi guys,

 

Just customizing WHMCS for the first time - cool software, I like it.

 

I want a login page on my website which I've created based on instructions in this forum.

 

I also want my login page to be the only login page that the customer can get to.

 

So I've edited includes/actionhooks.php and added a line to actionhook_ClientLogout so that when the user logs out they are redirected to my site and my custom login page works well.

 

They only thing I can't figure out how to do is if the user enters an incorrect username/password they end up at /clientarea.php?incorrect=true

 

Any way I can change that so that they end up back at my login page instead?

 

Thanks, Matt

Link to comment
Share on other sites

Hi guys,

 

Just customizing WHMCS for the first time - cool software, I like it.

 

I want a login page on my website which I've created based on instructions in this forum.

 

I also want my login page to be the only login page that the customer can get to.

 

So I've edited includes/actionhooks.php and added a line to actionhook_ClientLogout so that when the user logs out they are redirected to my site and my custom login page works well.

 

They only thing I can't figure out how to do is if the user enters an incorrect username/password they end up at /clientarea.php?incorrect=true

 

Any way I can change that so that they end up back at my login page instead?

 

Thanks, Matt

 

there are 2 teplate files login.tpl abd logout.tpl.

You could edit these or place php/js redirect code in them

Link to comment
Share on other sites

Hi Shaun,

 

Thanks for the reply.

 

The closest I've got so far is modifying the line at the top of login.tpl that checks if is an incorrect login to this -

{if $incorrect} <meta http-equiv="refresh" content="0; url=https://mysite.com/custlogin.html">  {/if}

 

This works but it briefly loads the normal customer area before redirecting to my site.

 

It looks like I can't use a PHP header line as text has already been sent to the browser, and I don't want to have to rely on javascript being enabled on the client.

 

I guess I could check out doing a redirect using .htaccess if there's nothing in WHCMS to help with it?

 

Thanks, Matt

Link to comment
Share on other sites

Just an update ...

 

I did what I wanted with Rewrite rules in httpd.conf -

 

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{QUERY_STRING} ^incorrect=true$
RewriteRule ^clientarea\.php$ [url]https://mysite.com/custlogin.html?[/url] [R=301,L]

Link to comment
Share on other sites

  • 7 months later...

Another update!

 

I did the way with go.php

 

You have to create a go.php file with the code:

 

<?php

   if ($incorrect) {
       header( "Location: http://www.your-whmcs-domain.com/clientarea.php?incorrect=true" );
   }
   else {
     header("Location: /index.php"); // here you can set any page of destination after logging
   }

?>

 

After edit the login.tpl and where it says:

<form action="{$formaction}" method="post" name="frmlogin" id="frmlogin">

 

replace by:

 

<form action="dologin.php?goto=go" method="post" name="frmlogin" id="frmlogin">

 

Don't forget to save go.php on the root of WHMCS.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated