public bool Login(string username, string password) { var user = _userStore.GetUserByUsername(username); if (user == null) { return(false); } var encodedPassword = _encoder.Encode(password, user.Salt); var passed = encodedPassword.Equals(user.Password); if (passed) { _applicationEnvironment.IssueAuthTicket(username, true); return(true); } return(false); }
public Guid?ValidateUser(string username, string password) { var user = _userStore.GetUserByUsername(username); if (user == null) { return(null); } if (_encoder.Encode(password, user.Salt).Equals(user.Password)) { return(new Guid(user.Id)); } return(null); }
/// <summary> /// Determines whether the provided <paramref name="username"/> and /// <paramref name="password"/> combination is valid /// </summary> /// <param name="username">The username.</param> /// <param name="password">The password.</param> /// <param name="rememberMe"> /// if set to <c>true</c> [remember me]. /// </param> /// <returns> /// /// </returns> public bool Login(string username, string password, bool rememberMe = false) { IFlexMembershipUser user = _userStore.GetUserByUsername(username); if (user == null) { return(false); } string encodedPassword = _encoder.Encode(password, user.Salt); bool passed = encodedPassword.Equals(user.Password); if (passed) { _applicationEnvironment.IssueAuthTicket(username, rememberMe); return(true); } return(false); }