Advertisement
LYSoft

Untitled

May 21st, 2014
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.49 KB | None | 0 0
  1.         public User Login(string Email, string Pass)
  2.         {
  3.             var user = db.Users.Include(r => r.Role).FirstOrDefault(e => e.EmailAddress == Email);
  4.  
  5.             if (user == null)
  6.                 throw new Exception("User not found");
  7.  
  8.             if (Hashing.ValidatePassword(Pass, user.Password))
  9.                 return user;
  10.  
  11.             // if we got here, something went wrong, throw an exception
  12.             throw new Exception("Invalid email address or password.");
  13.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement