Exemplo n.º 1
0
        private bool ValidationUser(string email, string password)
        {
            var logUser = _userService.GetUserByEmail(email);

            if (logUser != null)
            {
                MainWindowData.CurrentUser = logUser;
            }

            return(MainWindowData.CurrentUser.PasswordHash.Equals(Scrambler.GetPassHash(password)));
        }
Exemplo n.º 2
0
        public User RegistrationUser(string firstName, string lastName, string email, string password)
        {
            SmtpMailer mailer = SmtpMailer.Instance();

            if (_userService.GetUserByEmail(email) == null)
            {
                User newUser = new User
                {
                    FirstName    = firstName,
                    LastName     = lastName,
                    Email        = email,
                    PasswordHash = Scrambler.GetPassHash(password)
                };

                _userService.CreateUser(newUser);
                mailer.SentRegisterNotification(email);

                MainWindowData.CurrentUser = newUser;

                return(newUser);
            }
            throw new CustomException(Resources.ExistEmailError);
        }