Beispiel #1
0
        public GenerateResetPasswordTokenResult GenerateResetPasswordToken(string username)
        {
            if (string.IsNullOrEmpty(username))
            {
                throw new ArgumentNullException("username");
            }
            GenerateResetPasswordTokenResult result = new GenerateResetPasswordTokenResult();
            var customer = CustomerProvider.QueryByUserName(username);

            #region Validation
            if (customer == null)
            {
                result.Errors.Add("The customer does not exists.".Localize());
            }
            #endregion
            if (result.Success)
            {
                var token = Kooboo.UniqueIdGenerator.GetInstance().GetBase32UniqueId(10);

                result.Token = token;

                customer.Membership.ResetPasswordToken = token;
                CustomerService.Update(customer);
            }

            return(result);
        }
        public GenerateResetPasswordTokenResult GenerateResetPasswordToken(string username)
        {
            if (string.IsNullOrEmpty(username))
            {
                throw new ArgumentNullException("username");
            }
            GenerateResetPasswordTokenResult result = new GenerateResetPasswordTokenResult();
            var customer = CustomerProvider.QueryByUserName(username);
            #region Validation
            if (customer == null)
            {
                result.Errors.Add("The customer does not exists.".Localize());
            }
            #endregion
            if (result.Success)
            {
                var token = Kooboo.UniqueIdGenerator.GetInstance().GetBase32UniqueId(10);

                result.Token = token;

                customer.Membership.ResetPasswordToken = token;
                CustomerService.Update(customer);
            }

            return result;
        }