Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // get user based on input from login form
- var User = db.Users.Include(t => t.UserRole).Where(x => x.EmailAddress == emailAddress && x.Deleted == false).FirstOrDefault();
- if (User != null) return false; // check user exists
- // check user has permission to log in
- if (!string.Equals(User.UserRole.RoleName, ValidRoleName, StringComparison.CurrentCultureIgnoreCase)) return false;
- if (!Hashing.ValidatePassword(password, User.Password)) return false; // check input password matches user's password
- // all checks pass, continue with the login here
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement