<p>I have an instance of a front-end password update form running on one of my Craft Pro 2.3.2635 sites, and it works correctly. If I submit the form with the correct current password and valid new password, it updates the user, and if there is a problem, it displays an error message.</p>

<p>However, when I use the same code on a new build, if I leave both the current and existing password fields blanks it fails to correctly validate redirects to the page specified in my redirect input field, and the on user save event is fired. The same form on my other build appears to fail validation with the message 'Password  cannot be blank'.</p>

<p>All other erroring including the password length, and incorrect current password checks seem to run fine. Why might the 'Password cannot be blank' not be working on my new site?</p>

<p>I've included my form template below:</p>

<pre><code>{% macro errorList(errors) %}
    {% if errors %}
        {% for error in errors %}
            &lt;li class="agents-login__error"&gt;{{ error }}&lt;/li&gt;
        {% endfor %}
    {% endif %}
{% endmacro %}
{% from _self import errorList %}

{% extends "_layout" %}

{% block content %}

{% if not user %}
    {% redirect "/login" %}
{% else %}

    &lt;div class="agents-login"&gt;
        &lt;div class="agents-login__form-holder"&gt;
            &lt;a href="/"&gt;
                &lt;img src="/assets/images/logo.svg" class="agents-login__logo" width="158" height="107" /&gt;
            &lt;/a&gt;
            &lt;p class="message"&gt;Enter your existing password, then choose a new one and click save.&lt;/p&gt;

            &lt;form class="agents-login__form  [ form  form--agents ]" method="post" action="" accept-charset="UTF-8" enctype="multipart/form-data"&gt;
                {{ getCsrfInput() }}

                &lt;input type="hidden" name="action" value="users/saveUser"&gt;
                &lt;input type="hidden" name="redirect" value="/agents"&gt;
                &lt;input type="hidden" name="userId" value="{{ user.id }}"&gt;

                {% if account is defined %}
                    &lt;ul class="agents-login__errors"&gt;
                        {{ errorList(account.getErrors('currentPassword')) }}
                        {{ errorList(account.getErrors('newPassword')) }}
                    &lt;/ul&gt;
                {% endif %}

                &lt;div class="[ form__row  form__row--agents ]  layout"&gt;
                    &lt;div class="[ form__cell  form__cell--agents ]  layout__item"&gt;
                        &lt;label class="form__label" for="password" class="form__label"&gt;Existing Password&lt;/label&gt;
                        &lt;input class="form__control" id="currentPassword" type="password" name="password"&gt;
                    &lt;/div&gt;&lt;div class="[ form__cell  form__cell--agents ]  layout__item"&gt;
                        &lt;label class="form__label" for="newPassword"&gt;New Password&lt;/label&gt;
                        &lt;input class="form__control" id="newPassword" type="password" name="newPassword"&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
                &lt;div class="[ form__row  form__row--agents ]  layout"&gt;
                    &lt;div class="[ form__cell  form__cell--agents ]  layout__item"&gt;
                        &lt;input type="submit" value="Save" class="[ btn  btn--full ]" /&gt;
                    &lt;/div&gt;
                &lt;/div&gt;

                &lt;div class="agents-login__back-to-downloads"&gt;&lt;a href="/agents"&gt;Back to downloads&lt;/a&gt;&lt;/div&gt;
            &lt;/form&gt;
        &lt;/div&gt;
    &lt;/div&gt;
{% endif %}

{% endblock %}
</code></pre>

CC BY-SA 3.0
2015-02-26T22:35:50.470Z
Are they both running the same version/build of Craft?  Are they using the same settings under Settings->Users?
Brad Bell
CC BY-SA 3.0
2015-03-02T17:42:17.843Z
Yes, they're both running 2.3.2635, and have both got both checkboxes in User > Settings unchecked.
Alex H
<password>
What could be causing the 'Password cannot be blank' validation check not to run on user update?
# What could be causing the 'Password cannot be blank' validation check not to run on user update?

(Asked by: username_0 on 2015-02-26)

I have an instance of a front-end password update form running on one of my Craft Pro 2.3.2635 sites, and it works correctly. If I submit the form with the correct current password and valid new password, it updates the user, and if there is a problem, it displays an error message.
However, when I use the same code on a new build, if I leave both the current and existing password fields blanks it fails to correctly validate redirects to the page specified in my redirect input field, and the on user save event is fired. The same form on my other build appears to fail validation with the message 'Password  cannot be blank'.
All other erroring including the password length, and incorrect current password checks seem to run fine. Why might the 'Password cannot be blank' not be working on my new site?
I've included my form template below:
{% macro errorList(errors) %}
    {% if errors %}
        {% for error in errors %}
            {{ error }}
        {% endfor %}
    {% endif %}
{% endmacro %}
{% from _self import errorList %}

{% extends "_layout" %}

{% block content %}

{% if not user %}
    {% redirect "/login" %}
{% else %}

    
        
            
                
            
            Enter your existing password, then choose a new one and click save.

            
                {{ getCsrfInput() }}

                
                
                

                {% if account is defined %}
                    
                        {{ errorList(account.getErrors('currentPassword')) }}
                        {{ errorList(account.getErrors('newPassword')) }}
                    
                {% endif %}

                
                    
                        Existing Password
                        
                    
                        New Password
                        
                    
                
                
                    
                        
                    
                

                Back to downloads
            
        
    
{% endif %}

{% endblock %}

**Tags:** password
> **Comments:**
> **username_1**: Are they both running the same version/build of Craft?  Are they using the same settings under Settings->Users?  
> **username_0**: Yes, they're both running 2.3.2635, and have both got both checkboxes in User > Settings unchecked.  

---

## 0 answers

