Advertisement
Guest User

Untitled

a guest
Jul 30th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. def do_edit
  2. catch (:redoEdit) do
  3. @user = loggedInUser
  4. @text_pass = params['text_pass']
  5. @pass_again = params['pass_again']
  6.  
  7. if !@text_pass.empty? or !@pass_again.empty?
  8. if @pass_again.empty?
  9. addFlash("Please enter your new passphrase a second time")
  10. throw :redoEdit
  11. elsif @pass_again != @text_pass
  12. addFlash("Passphrases do not match")
  13. throw :redoEdit
  14. else
  15. params['user']['login_pass'] = Digest::SHA1.hexdigest(@text_pass)
  16. end
  17. end
  18.  
  19. params['user'].keep_keys ['login_name', 'login_pass', 'user_email',
  20. 'login_challenge', 'login_response']
  21.  
  22. if not @user.update_attributes(params['user'])
  23. throw :redoEdit
  24. end
  25.  
  26. # Success
  27. addFlash("Account has been updated")
  28. redirect_to :action=>'edit'
  29. return
  30. end
  31.  
  32. # Failure
  33. flash['text_pass'] = @text_pass
  34. flash['pass_again'] = @pass_again
  35. redirect_to :action=>'edit'
  36. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement