<% form_for :user, @user, :url => { :id => @user.id, :action => 'update_password'}, :html => { :id =>'user_form', :method => @user.id.nil? ?  :post : :put} do |f| %>
  <fieldset>
      <div class="modal-head">
          <h2>Change password for user: <%= h @user.login -%></h2>
      </div>
      <div class="modal-body">
        <% if @errors
             @errors.each do |error|
        %>
            <p class="error"><%= h error -%></p>
          <% end
             end
          %>
        <div class="modal-field">
            <% if @user.id %>
              <%= f.hidden_field :login %>
            <% else %>
              <%= f.text_field :login, :size => 30, :maxLength => 255 %>
            <% end %>
        </div>
          <div class="modal-field"><label for="user[password]">New password <em class="mandatory">*</em></label><%= f.password_field :password, :size => 30, :maxLength => 50, :autocomplete => 'off' %></div>
          <div class="modal-field"><label for="user[password_confirmation]">Confirm password <em class="mandatory">*</em></label><%= f.password_field :password_confirmation, :size => 30, :maxLength => 50, :autocomplete => 'off' %></div>

        </div>
      <div class="modal-foot">
          <%= submit_tag 'Save' %>
          <%= link_to 'Cancel', { :controller => 'users', :action => 'index'}, { :class => 'action' } %><br/>
      </div>
  </fieldset>
<% end %>

<script>
  $j("#user_form").modalForm();
</script>
