public IHttpActionResult SendResetPasswordEmail(AccountInput param, bool test = false, bool throwError = false) { try { var token = resetPasswordTokenApp.GenerateResetPasswordToken(param.email, base.ClientId, param.url_back, param.email_template_code); #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(new ArgumentException(ex.Message))); } catch (AccountNotFoundException) { if (throwError) { return(NotFound()); } return(Ok()); } catch (ArgumentException ex) { return(BadRequest(ex)); } catch (Exception ex) { return(InternalServerError(ex)); } }
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()); } }