I've got a user registration form on my site, using the code from Craft's documentation. How can I get the form working so it asks the user to enter their email address and password twice? Can Craft take care of that or do I need to use client-side JS validation?

3 Answers 3


This is something you should let JavaScript take care of. Craft does not check a 'second' email or password field, so you should make sure the two field values are identical before posting the values to Craft's controller.


If anyone is interested in confirming passwords still, I have wrote a plugin which does just this, it doesn't rely on it's own controller either so there is no bypassing of Crafts own workings :)


All you need to do is add a passwordConfirm field to your existing form:

<input type="password" name="passwordConfirm">
{% if account is defined %}
  {{ account.getErrors('passwordConfirm') }}
{% endif %}

It doesn't confirm emails though..sorry

  • This is great, and can easily be modified to support confirm email as well! Mar 9, 2017 at 18:21

In addition to letting JavaScript take care of the extra front-end logic, you could also write a plugin that exposes a controller that does the extra email and password sameness checks from PHP.

If those are equal, then it would just pass the data off to craft()->users->saveUser(), otherwise, return any validation errors back to the template.

  • Thanks Brad - will bear that in mind for the future if I ever manage to get my head around OO PHP :) Sep 12, 2014 at 15:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.