Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%= error_messages_for 'user' %>
- <% form_tag(:action => 'user_edit_submit') do %>
- <!--[form:site]-->
- <table>
- <tr>
- <th>Username</th><th><%= @user.login%></th>
- </tr>
- <tr>
- <td><label for="email">Email Address</label></td><td><%= text_field 'user', 'email' %></td>
- </tr>
- <tr>
- <td><label for="password">Password</label></td><td><input id='password' type='password' name='user[password]' size='30'></td>
- </tr>
- <tr>
- <td><label for="confirm_password">Confirm Password</label></td><td><input id='confirm_password' type='password' name='user[confirm_password]' size='30'></td>
- </tr>
- <tr><td colspan=2>
- <p><%= submit_tag 'Update Information' %></p>
- </td></tr>
- </table>
- <!--[eoform:site]-->
- <% end %>
- -------------------------------
- Code:
- -------------------------------
- def user_edit_submit
- @user = self.current_user
- password = params[:password]
- confirm_password = params[:confirm_password]
- logger.info "Password is #{password}"
- if password == confirm_password and !password.nil?
- flash[:notice] = 'User info updated'
- @user.update(@user.id {params[:user]})
- redirect_to :action => 'user_edit'
- else
- flash[:notice] = 'Your two passwords did not match'
- redirect_to :action => 'user_edit'
- end
- end
- -------------------------------
- Problem:
- -------------------------------
- It -always- returns that the two passwords don't match.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement