Advertisement
Guest User

Untitled

a guest
Jul 31st, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. <%= error_messages_for 'user' %>
  2.  
  3. <% form_tag(:action => 'user_edit_submit') do %>
  4. <!--[form:site]-->
  5. <table>
  6. <tr>
  7. <th>Username</th><th><%= @user.login%></th>
  8. </tr>
  9. <tr>
  10. <td><label for="email">Email Address</label></td><td><%= text_field 'user', 'email' %></td>
  11. </tr>
  12. <tr>
  13. <td><label for="password">Password</label></td><td><input id='password' type='password' name='user[password]' size='30'></td>
  14. </tr>
  15. <tr>
  16. <td><label for="confirm_password">Confirm Password</label></td><td><input id='confirm_password' type='password' name='user[confirm_password]' size='30'></td>
  17. </tr>
  18. <tr><td colspan=2>
  19. <p><%= submit_tag 'Update Information' %></p>
  20. </td></tr>
  21. </table>
  22. <!--[eoform:site]-->
  23. <% end %>
  24.  
  25.  
  26.  
  27. -------------------------------
  28. Code:
  29. -------------------------------
  30. def user_edit_submit
  31. @user = self.current_user
  32. password = params[:password]
  33. confirm_password = params[:confirm_password]
  34. logger.info "Password is #{password}"
  35. if password == confirm_password and !password.nil?
  36. flash[:notice] = 'User info updated'
  37. @user.update(@user.id {params[:user]})
  38. redirect_to :action => 'user_edit'
  39. else
  40. flash[:notice] = 'Your two passwords did not match'
  41. redirect_to :action => 'user_edit'
  42. end
  43. end
  44. -------------------------------
  45. Problem:
  46. -------------------------------
  47. It -always- returns that the two passwords don't match.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement