This is a section of the user login code, with an extra check added to verify the status of UIsDeleted, which I have added to the table UserProfile.
For a change I am not getting any error messages, however that leaves me with no clues where to start.
Every user can login, including the ones that have UIsDeleted = True
Why?
var isdeleted = false;
// Validation
var isValid = true;
var usernameErrorMessage = "";
var passwordErrorMessage = "";
// If this is a POST request, validate and process data
if (IsPost) {
username = Request.Form["username"];
password = Request.Form["password"];
rememberMe = Request.Form["rememberMe"].AsBool();
// Validate the user's username
if (username.IsEmpty()) {
usernameErrorMessage = "You must specify a username.";
isValid = false;
}
// Validate the user's password
if (password.IsEmpty()) {
passwordErrorMessage = "You must specify a password.";
isValid = false;
}
// Check if members status is IsDeleted
var db = Database.Open("try1");
var row = db.QuerySingle("SELECT * FROM UserProfile WHERE UserName LIKE @0", username);
isdeleted = row.UIsDeleted;
if (isdeleted = false) {
usernameErrorMessage = "This user account has been deleted.";
isValid = false;
}
// Confirm there are no validation errors
if (isValid) {
wavemaster
Participant
1279 Points
1127 Posts
Expanded user login verification does not work
Aug 10, 2012 06:29 PM|LINK
This is a section of the user login code, with an extra check added to verify the status of UIsDeleted, which I have added to the table UserProfile.
For a change I am not getting any error messages, however that leaves me with no clues where to start.
Every user can login, including the ones that have UIsDeleted = True
Why?
var isdeleted = false; // Validation var isValid = true; var usernameErrorMessage = ""; var passwordErrorMessage = ""; // If this is a POST request, validate and process data if (IsPost) { username = Request.Form["username"]; password = Request.Form["password"]; rememberMe = Request.Form["rememberMe"].AsBool(); // Validate the user's username if (username.IsEmpty()) { usernameErrorMessage = "You must specify a username."; isValid = false; } // Validate the user's password if (password.IsEmpty()) { passwordErrorMessage = "You must specify a password."; isValid = false; } // Check if members status is IsDeleted var db = Database.Open("try1"); var row = db.QuerySingle("SELECT * FROM UserProfile WHERE UserName LIKE @0", username); isdeleted = row.UIsDeleted; if (isdeleted = false) { usernameErrorMessage = "This user account has been deleted."; isValid = false; } // Confirm there are no validation errors if (isValid) {Kenon-YGN
Member
378 Points
51 Posts
Re: Expanded user login verification does not work
Aug 14, 2012 09:19 AM|LINK
Hi,wavemaster
In the section of "// Check if members status is IsDeleted", I saw a mistake in the if sentence.
The judgement sentence should be like this (isdeleted==false)
Hope it be helpful.