public ResponseResult <bool> Authorize(UserAccountIdentifyInfoFull identifyInfoFull) { FormsAuthentication.SetAuthCookie(identifyInfoFull.Login, false); return(new ResponseResult <bool>(true)); var bl = _accountService.Authorize(identifyInfoFull); if (bl.Data) { FormsAuthentication.SetAuthCookie(identifyInfoFull.Login, false); } return(bl); }
public ResponseResult <bool> Authorize(UserAccountIdentifyInfoFull identifyInfoFull) { try { if (identifyInfoFull == null || string.IsNullOrEmpty(identifyInfoFull.Login) || string.IsNullOrEmpty(identifyInfoFull.Password) || string.IsNullOrEmpty(identifyInfoFull.Value)) { return(new ResponseResult <bool>(WronginputDataErrorMessage)); } return(new ResponseResult <bool>(_accountRepository.Authorize(identifyInfoFull))); } catch (Exception exception) { _loggingService.Log(this, AuthorizeErrorMessage, LogType.Error, exception); return(new ResponseResult <bool>(AuthorizeErrorMessage)); } }
public bool Authorize(UserAccountIdentifyInfoFull identifyInfoFull) { var userId = this.CheckUserPass(identifyInfoFull.Login, identifyInfoFull.Password); if (userId == Guid.Empty) { return(false); } string keyHash; using (var connection = new SqlConnection(_configurationService.DatabaseConnectionString)) { using (var command = connection.CreateCommand()) { command.CommandText = "SessionKeys "; command.Parameters.AddWithValue("@UserId", userId).SqlDbType = SqlDbType.UniqueIdentifier; connection.Open(); keyHash = (string)command.ExecuteScalar(); } } return(_helper.CompareStringWithHash(identifyInfoFull.Value, keyHash)); }