Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def do_edit
- catch (:redoEdit) do
- @user = loggedInUser
- @text_pass = params['text_pass']
- @pass_again = params['pass_again']
- if !@text_pass.empty? or !@pass_again.empty?
- if @pass_again.empty?
- addFlash("Please enter your new passphrase a second time")
- throw :redoEdit
- elsif @pass_again != @text_pass
- addFlash("Passphrases do not match")
- throw :redoEdit
- else
- params['user']['login_pass'] = Digest::SHA1.hexdigest(@text_pass)
- end
- end
- params['user'].keep_keys ['login_name', 'login_pass', 'user_email',
- 'login_challenge', 'login_response']
- if not @user.update_attributes(params['user'])
- throw :redoEdit
- end
- # Success
- addFlash("Account has been updated")
- redirect_to :action=>'edit'
- return
- end
- # Failure
- flash['text_pass'] = @text_pass
- flash['pass_again'] = @pass_again
- redirect_to :action=>'edit'
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement