public async Task SignUpAsync(string userName, string password, CancellationToken token) { _authorizationDataValidator.ValidateLogin(userName); _authorizationDataValidator.ValidatePassword(password); token.ThrowIfCancellationRequested(); var request = new SignUpRequest { Username = userName, Password = password }; var response = await _authorizationApi.SignUpAsync(request); token.ThrowIfCancellationRequested(); if (response.Status.IsFailure()) { throw new ServerUnhandledException(response.Message); } _authorizationUpdater.SaveSession(response.Result.TokenModel); }
public async Task SignUpAsync(string userName, string password, CancellationToken token) { await Task.Delay(2000); _authorizationDataValidator.ValidateLogin(userName); _authorizationDataValidator.ValidatePassword(password); if (_acceptableRequest.Username == userName) { throw new AuthorizationException(); } var tokenModel = new TokenModel { Token = "sdfsdfsdfs", ExpireAt = DateTimeOffset.Now.AddMinutes(30), CanBeUpdatedTill = DateTimeOffset.Now.AddDays(3) }; _authorizationUpdater.SaveSession(tokenModel); }
private void ValidateUserData(string username, string password) { _dataValidator.ValidateLogin(username); _dataValidator.ValidatePassword(password); }