Example #1
0
        public User GetUser(string email, string password)
        {
            User accountUser = null;

            try
            {
                password = DES.Encrypt(
                    this.settings.SecurityKey,
                    SHA2.GetSHA256Hash(password)
                    );

                accountUser =
                    this.accountUserRepository.Find(email, password);
            }
            catch (DataAccessLayerException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw new ServiceLayerException(ex);
            }

            return(accountUser);
        }
Example #2
0
        public void UpdatePassword(ObjectId userId, string password)
        {
            try
            {
                password = DES.Encrypt(
                    this.settings.SecurityKey,
                    SHA2.GetSHA256Hash(password)
                    );

                this.accountUserRepository.UpdatePassword(userId, password);
            }
            catch (DataAccessLayerException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw new ServiceLayerException(ex);
            }
        }
Example #3
0
        public void Save(User accountUser)
        {
            try
            {
                accountUser.Password = DES.Encrypt
                                       (
                    this.settings.SecurityKey,
                    SHA2.GetSHA256Hash(accountUser.Password)
                                       );

                accountUser.Name = accountUser.Name.Substring(0, 1).ToUpper() +
                                   accountUser.Name.Substring(1, accountUser.Name.Length - 1);

                this.accountUserRepository.Save(accountUser);
            }
            catch (DataAccessLayerException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw new ServiceLayerException(ex);
            }
        }