Advertisement
LoganYoung87

Untitled

May 30th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.54 KB | None | 0 0
  1. // get user based on input from login form
  2. var User = db.Users.Include(t => t.UserRole).Where(x => x.EmailAddress == emailAddress && x.Deleted == false).FirstOrDefault();
  3.  
  4. if (User != null) return false; // check user exists
  5.  
  6. // check user has permission to log in
  7. if (!string.Equals(User.UserRole.RoleName, ValidRoleName, StringComparison.CurrentCultureIgnoreCase)) return false;
  8. if (!Hashing.ValidatePassword(password, User.Password)) return false; // check input password matches user's password
  9.  
  10. // all checks pass, continue with the login here
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement