Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - form_tag change_password_users_path do
- = error_messages_for :user, :header_message => "Please Try Again", :message => "We had some problems updating your account"
- %br
- = label_tag :password, "New password:"
- = password_field_tag "password"
- %br
- = label_tag :password_confirmation, "NConfirm new password:"
- = password_field_tag "password_confirmation"
- %br
- = submit_tag "Update Account"
- def change_password
- @user = current_user
- if request.post?
- @user.password = params[:password]
- @user.password_confirmation = params[:password_confirmation]
- if @user.save
- redirect_to user_path(current_user)
- else
- render :action => "change_password"
- end
- end
- end
- def change_password
- @user = current_user
- if request.post?
- @user.password = params[:user][:password]
- @user.password_confirmation = params[:user][:password_confirmation]
- if @user.changed? && @user.save
- redirect_to user_path(current_user)
- else
- render :action => "change_password"
- end
- end
- end
- @user.current_password = params[:user][:current_password]
- @user.password = params[:user][:password]
- @user.password_confiramtion = params[:user][:password_confirmation]
- if @user.save
- UserSession.create(:login => @user.login, :password => params[:user][:password])
- redirect_to user_path(current_user)
- else
- render :action => :change_password
- end
Add Comment
Please, Sign In to add comment