public Notification Logout(string token) { var notification = new Notification(); notification.Add(String.IsNullOrWhiteSpace(token, "Token")); return notification; }
public Notification Active(string username) { var notification = new Notification(); notification.Add(String.IsNullOrWhiteSpace(username, "Username")); if (!_accountRepository.IsExist(username)) notification.Add(new NotificationItem(NotificationType.Error, ErrorUsernameDoesNotExist)); return notification; }
public Notification Create(string username, string password) { var notification = new Notification(); notification.Add(String.IsNullOrWhiteSpace(username, "Username")); notification.Add(String.IsNullOrWhiteSpace(password, "Password")); if (_accountRepository.IsExist(username)) notification.Add(new NotificationItem(NotificationType.Error, ErrorUsernameDuplication)); return notification; }
public Notification Login(string username, string password) { var notification = new Notification(); notification.Add(String.IsNullOrWhiteSpace(username, "Username")); notification.Add(String.IsNullOrWhiteSpace(password, "Password")); Domain.Models.Account.Account account = _accountRepository.GetAccountbyUsername(username); // TODO: Move salt to somewhere var saltedPassword = $"Salt+ {password}"; var hashedPassword = saltedPassword.ToSha1(); if (hashedPassword != account.Password) notification.Add(new NotificationItem(NotificationType.Error, ErrorUsernameDuplication)); return notification; }
public Notification IsExist(string username) { var notification = new Notification(); notification.Add(String.IsNullOrWhiteSpace(username, "Username")); return notification; }