Esempio n. 1
0
 public IHttpActionResult Exists(CustomerImportinput input)
 {
     try
     {
         return(Ok((object)customerImportApp.Exists(input.username, input.store_code)));
     }
     catch (ArgumentException ex)
     {
         return(BadRequest(ex));
     }
     catch (Exception ex)
     {
         return(InternalServerError(ex));
     }
 }
Esempio n. 2
0
        public IHttpActionResult SendResetPasswordEmail(CustomerImportinput input, bool test = false, bool throwError = false)
        {
            var identity = ActionContext.ActionArguments["identity"] as JwtToken;

            if (input != null)
            {
                try
                {
                    if (input.username.IsNullOrWhiteSpace())
                    {
                        throw new ArgumentException("o parâmetro email não pode nulo");
                    }
                    else if (input.store_code.IsEmpty())
                    {
                        throw new ArgumentException("o parâmetro storeCode não pode nulo");
                    }
                    else
                    {
                        var token = resetPasswordTokenApp.GenerateResetPasswordToken(input.username, input.store_code, input.url_back);
#if DEBUG
                        if (test)
                        {
                            return(Ok(new { reset_password_token = token }));
                        }
#endif
                        if (throwError && token.IsNullOrWhiteSpace())
                        {
                            return(NotFound());
                        }

                        return(Ok());
                    }
                }
                catch (LockedUpMemberException ex)
                {
                    return(BadRequest(ex.Message));
                }
            }
            else
            {
                return(BadRequest());
            }
        }
Esempio n. 3
0
        public IHttpActionResult ResetPassword(CustomerImportinput param)
        {
            var identity = ActionContext.ActionArguments["identity"] as JwtToken;

            if (param != null)
            {
                try
                {
                    if (!string.IsNullOrWhiteSpace(param.password))
                    {
                        customerImportApp.CreatePassword(base.AccountCode, identity.name, param.password, base.ClientId);
                        return(Ok());
                    }
                    else
                    {
                        throw new ArgumentException("o parâmetro password não pode ser nulo");
                    }
                }
                catch (LockedUpMemberException ex)
                {
                    return(BadRequest(new ArgumentException(ex.Message)));
                }
                catch (PasswordException ex)
                {
                    return(BadRequest(ex.Message));
                }
                catch (ArgumentException ex)
                {
                    return(BadRequest(ex));
                }
                catch (Exception ex)
                {
                    return(InternalServerError(ex));
                }
            }
            else
            {
                return(BadRequest());
            }
        }
Esempio n. 4
0
        public IHttpActionResult Remove(CustomerImportinput input)
        {
            if (input != null)
            {
                try
                {
                    customerImportApp.RemoveMember(input.email, input.document);

                    return(Ok());
                }
                catch (ArgumentException ex)
                {
                    return(BadRequest(ex));
                }
                catch (Exception ex)
                {
                    return(InternalServerError(ex));
                }
            }
            else
            {
                return(BadRequest());
            }
        }
Esempio n. 5
0
 public IHttpActionResult SendResetPasswordEmailWithCheck(CustomerImportinput param)
 {
     return(SendResetPasswordEmail(param, throwError: true));
 }
Esempio n. 6
0
 public IHttpActionResult SendResetPasswordEmail(CustomerImportinput input)
 {
     return(SendResetPasswordEmail(input, true));
 }