Loging redirection

Issues related to the Login tools of WYSIWYG Web Builder.
Forum rules
PLEASE READ THE FORUM RULES BEFORE YOU POST:
viewtopic.php?f=12&t=1901

MUST READ:
http://www.wysiwygwebbuilder.com/login_basics.html
http://www.wysiwygwebbuilder.com/login_tools.html

TIP:
A lot of information about the login tools can be found in the help/manual.
Also checkout the demo template that is include with the software.
Post Reply
User avatar
alex4orly
 
 
Posts: 632
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Loging redirection

Post by alex4orly »

I am using the Login object, on initial - first time entry I set the user name / password to the same value (using a csv flat file for data storage).
I want to "Force" the visitor to go on his first visit to a page to change his password.

I added two events - Onclick on the button, like this :

JavaScript function - checkEmail();
Onclick - Link to the relevant page in my project - this works as expected.

My checkEmail(); function is inserted into the HTML page just before the /body> tag, below is the function - but ' after the first login and the password change, the function is again behaving as if the username and password are still equal... WHY? I know they are not equal...

<script type="text/javascript">
function checkEmail()
{
if (loginform.username.value == loginform.password.value)
{
alert('Please update your password and your details');
.....;
} else {
.....;
}
}
</script>
User avatar
Pablo
 
Posts: 21574
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Loging redirection

Post by Pablo »

Although I cannot teach you how to write code, I doubt that this is correct/reliable:

Code: Select all

if (loginform.username.value == loginform.password.value)
Shouldn't you use this?

Code: Select all

document.getElementById("username").value;
Also note that login happens on the server (via PHP). So the values may not be valid in the browser.
User avatar
alex4orly
 
 
Posts: 632
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: Loging redirection

Post by alex4orly »

Well, it seems that the "Remember me" was the problem, maybe the cookies installed on my PC when I checked this option, would like to hear that I am wrong, because I really appreciate the benefit of this option.

Anyway, it now works with a single event on the Submit button - checkEmail();
And, the following JS function does the trick

Thanks Pablo

<script type="text/javascript">
function checkEmail()
{
if (loginform.username.value == loginform.password.value)
{
window.location.href='http://www.nmaa-rc.org.au/editprofile_html.php';
alert('The Password you used is just for first time visitors\rPlease change it and fill in the other details.\r Once you Submit changes - Log in again');
}
else
{
window.location.href='http://www.nmaa-rc.org.au/membershiprenewal.php';
}
}
</script>
Post Reply