/// <summary> /// Verifies that the specified user name and password exist in the data source. /// </summary> /// <returns> /// true if the specified username and password are valid; otherwise, false. /// </returns> /// <param name="username">The name of the user to validate. </param><param name="password">The password for the specified user. </param> public override bool ValidateUser(string username, string password) { var possibleUser = _context.users.Where(x => x.username == username).FirstOrDefault(); if (possibleUser == null) { return(false); } if (possibleUser.activestatus == false) { return(false); } var decryptedCode = TripleDES.DecryptString(possibleUser.usercode); var sha1Pswd = PasswordHelper.GenerateHashedPassword(password, decryptedCode); return(possibleUser.password == sha1Pswd); // return false; }
/// <summary> /// Verifies that the specified user name and password exist in the data source. /// </summary> /// <returns> /// true if the specified username and password are valid; otherwise, false. /// </returns> /// <param name="username">The name of the user to validate. </param><param name="password">The password for the specified user. </param> public override bool ValidateUser(string username, string password) { var userRepository = InstanceFactory.CreateUserInstance(); var possibleUser = userRepository.GetUserObjByUserName(username); if (possibleUser == null) { return(false); } if (!possibleUser.UserActiveStatus.HasValue || possibleUser.UserActiveStatus == 0) { return(false); } var decryptedCode = TripleDES.DecryptString(possibleUser.UserCode); var sha1Pswd = PasswordHelper.GenerateHashedPassword(password, decryptedCode); return(possibleUser.Password == sha1Pswd); }