From c9de5656c374b5f794c671b64f6cfe4d27ee6b83 Mon Sep 17 00:00:00 2001 From: s426226 Date: Sat, 9 Jan 2021 11:55:07 +0100 Subject: [PATCH] POS-43 --- Serwer/Serwer.Core/Domain/User.cs | 10 +++++----- Serwer/Serwer.Infrastructure/Services/UserService.cs | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Serwer/Serwer.Core/Domain/User.cs b/Serwer/Serwer.Core/Domain/User.cs index 0d3a56b..59391a2 100644 --- a/Serwer/Serwer.Core/Domain/User.cs +++ b/Serwer/Serwer.Core/Domain/User.cs @@ -33,7 +33,7 @@ namespace Serwer.Core.Domain { if (string.IsNullOrWhiteSpace(email)) { - throw new Exception("Email cannot be empty"); + throw new Exception("Email nie może być pusty."); } if (Email == email) { @@ -48,7 +48,7 @@ namespace Serwer.Core.Domain { if (string.IsNullOrWhiteSpace(name)) { - throw new Exception("Name cannot be empty"); + throw new Exception("Imię nie może być puste."); } if (Name == name) { @@ -63,7 +63,7 @@ namespace Serwer.Core.Domain { if (string.IsNullOrWhiteSpace(surname)) { - throw new Exception("Surname cannot be empty"); + throw new Exception("Nazwisko nie może być puste."); } if (Surname == surname) { @@ -78,7 +78,7 @@ namespace Serwer.Core.Domain { if (string.IsNullOrWhiteSpace(login)) { - throw new Exception("Login cannot be empty"); + throw new Exception("Login nie może być pusty."); } if (Login == login) { @@ -93,7 +93,7 @@ namespace Serwer.Core.Domain { if (string.IsNullOrWhiteSpace(password)) { - throw new Exception("Password cannot be empty"); + throw new Exception("Hasło nie może być puste."); } if (Password == password) { diff --git a/Serwer/Serwer.Infrastructure/Services/UserService.cs b/Serwer/Serwer.Infrastructure/Services/UserService.cs index 35120c7..b4618d3 100644 --- a/Serwer/Serwer.Infrastructure/Services/UserService.cs +++ b/Serwer/Serwer.Infrastructure/Services/UserService.cs @@ -29,7 +29,7 @@ namespace Serwer.Infrastructure.Services { if(await _userRepository.GetAsync(login) != null) { - throw new Exception($"User with login: {login} already exists."); + throw new Exception($"Użytkownik z loginem: {login} już istnieje."); } var user = new User(Guid.NewGuid(), email, name, surname, login, password); await _userRepository.AddAsync(user); @@ -40,11 +40,11 @@ namespace Serwer.Infrastructure.Services var user = await _userRepository.GetAsync(login); if(user == null) { - throw new Exception("User not found."); + throw new Exception("Nie znaleziono użytkownika."); } if(user.Password != password) { - throw new Exception("Incorrect password."); + throw new Exception("Hasło niepoprawne."); } var jwt = _jwtHandler.CreateToken(user.Id); @@ -61,12 +61,12 @@ namespace Serwer.Infrastructure.Services var user = await _userRepository.GetAsync(userModel.Id); if(user == null) { - throw new Exception("User not found."); + throw new Exception("Nie znaleziono użytkownika."); } var userLoginTaken = await _userRepository.GetAsync(userModel.Login); if(userLoginTaken != null && userLoginTaken.Id != user.Id) { - throw new Exception("User login taken."); + throw new Exception("Login jest już zajęty."); } var newUser = new User(user.Id, userModel.Email, userModel.Name, userModel.Surname, userModel.Login, user.Password);