close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Login always redirects to lost password

Thread begun 2/11/2011 8:40 am by markhaynes75235 | Last modified 2/11/2011 10:04 am by Jason Byrnes | 3516 views | 7 replies |

markhaynes75235

Login always redirects to lost password

Hi guys

I'm experiencing a problem on my site - when I log in with the correct username and password, I'm always redirected to the send lost password page. The send lost password page works but the login page is not redirecting to the users_profile.php page Here's the authenticate user server behavior code on users_login.php:

<?php
if($_SERVER["REQUEST_METHOD"] == "POST"){
$WA_Auth_Parameter = array(
"connection" => $ucpntx,
"database" => $database_ucpntx,
"tableName" => "users",
"columns" => explode($WA_Auth_Separator,"idusers".$WA_Auth_Separator."userPassword"),
"columnValues" => explode($WA_Auth_Separator,"".((isset($_POST["username"]))?$_POST["username"]:"") ."".$WA_Auth_Separator."".((isset($_POST["userpassword"]))?$_POST["userpassword"]:"") .""),
"columnTypes" => explode($WA_Auth_Separator,"int".$WA_Auth_Separator."text"),
"sessionColumns" => explode($WA_Auth_Separator,"idusers"),
"sessionNames" => explode($WA_Auth_Separator,"idusers"),
"successRedirect" => "users_Profile.php",
"failRedirect" => "users_EmailPW.php",
"gotoPreviousURL" => TRUE,
"keepQueryString" => TRUE
);

WA_AuthenticateUser($WA_Auth_Parameter);
}
?>

Sign in to reply to this post

Jason ByrnesWebAssist

in the authenticate users server behavior, you are using the idusers column for the user name.

This appears to be the Primary key column of the table?

you should change this to use a username or email column from the table.

Sign in to reply to this post

markhaynes75235

So in the lines:

"sessionColumns" => explode($WA_Auth_Separator,"idusers"),
"sessionNames" => explode($WA_Auth_Separator,"idusers"),

it should be

"sessionColumns" => explode($WA_Auth_Separator,"userEmail"),
"sessionNames" => explode($WA_Auth_Separator,"userEmail"),

since I'm using the email address as the unique identifier.

Thanks for your quick response!
enthusiastically...

Sign in to reply to this post

Jason ByrnesWebAssist

no, leave those lines alone.


dont change this in the code Mark, change it in the UI.

Double Click on the Authenticate user Server behavior, leave the first step as is, click the next button to go to the second step.

on the second step change it to use the email column as the username column instead of the idusers column.

Sign in to reply to this post

markhaynes75235

Login always redirects to lost password

Thanks Jason:

The second screen does not allow me to use the email address - just the form variables for Username and Password, which is what I have selected (see attached image).

Do I need to add a recordset to pull the user data in the server behavior?

Thanks!

Sign in to reply to this post

Jason ByrnesWebAssist

select the first idusers column and click the minus button to remove it.


Then click the plus button and select the UserEmail column. Click the lightning bolt next to value and select the username form element.

Sign in to reply to this post

markhaynes75235

OK I understand what's going on - but the second screen is where you set up the comparison, so should it not be:

userName = <?php echo((isset($_POST["username"]))?$_POST["username"]:""); ?>
userPassword = <?php echo((isset($_POST["userpassword"]))?$_POST["userpassword"]:""); ?>

to compare those two columns with their correponding form values. I thought I had defined the unique column to be the email address so that if a user registers using an email address that has already been used will be sent to the login page as they are already registered, so perhaps I had misinformed you. Now when I log in I'm taken to the users_Profile page. Everything appears to be working correctly now. Thanks!

enthusiastically...

Sign in to reply to this post

Jason ByrnesWebAssist

if you are using the username for comparison then, yes, that is how it should be.

setting the email column to be unique has nothing to do with the comparison used for login

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...