Example #1
0
//ResetPassword requests the password reset operation to start.
func ResetPassword(cmd *cli.Cmd) {
	email := cmd.String(cli.StringArg{
		Name:      "EMAIL",
		Desc:      "email address",
		HideValue: true,
	})

	cmd.Action = func() {
		a := authorization.Account{
			Email: *email,
		}

		account, resp, errs := a.ResetPassword()

		if len(errs) > 0 {
			log.Fatalf("Could not retrieve account: %s", errs[0])
		}

		if resp.StatusCode != 204 {
			log.Fatalf("Could not reset account password: %s", resp.Status)
		}

		fmt.Println("Password reset instructions sent to:", account.Email)
	}
}