How do I setup a password administration workflow using setPasswordPath and a forgot password page? I have a couple of issues regarding administering users passwords from the front-end of my site.

Firstly, I'm trying to implement the Set Password form as listed at https://craftcms.com/docs/templating/set-password-form.

I have created a single pointing to the path specified in the setPasswordPath config entry, using a template containing the above form. However, when I navigate to the setPasswordPath page it is erroring saying that 'Variable "code" does not exist'. When I remove the hidden code field, the id variable errors in the same way.

Secondly, the forgot password form listed at https://craftcms.com/docs/templating/forgot-password-form works great, except for when the user navigates to the link in the e-mail, and then enters their new password, they are redirected the Craft dashboard login, which a lot of the end users should never really see. Is it possible to redirect people  to my home page login form on the front-end?
The form that lives at setPasswordPath assumes that the user arrived there by clicking on the link in the validation email that was sent to the provided email address.  That link includes a code=somelongid querystring parameter in the URL that the form is looking for.

If you're just loading that URL directly, then you'll get the "Variable 'code' does not exist" error.  You could always do something like this to guard against it:

{% set code = craft.request.getParam('code') %}

{% if not code %}
    {% exit 503 %}
{% endif %}


Regarding the forgot password form, upon successfully setting their new password, Craft will check to see if the user has control panel access.  If they do not, it will check the setPasswordSuccessPath config variable and redirect there.  If they do, Craft will send them to the dashboard (which will redirect to the login page if you don't have autoLoginAfterAccountActivation set.