You might be looking to redirect a customer to another URL rather than either the shop homepage or the customer account page. In order to do this, you can set the beforeAuthUrl(). The afterAuthUrl() function works for post-login functions.

However, the easiest way to do this, can be to set a hidden input field “success_url” within your form. The trick for this however, is that the value for this field must be absolute. You cannot pass this field as simply /cart/checkout, it should be