= params[:user] u.delete(:password) if u[:password].blank? u.delete(:password_confirmation) if u[:password].blank? and u[:password_confirmation].blank? u.delete(:language) if u[:language].blank? # change email notifications if u[:email_preferences] @user.update_user_preferences(u[:email_preferences]) flash[:notice] = I18n.t 'users.update.email_notifications_changed' # change password elsif u[:current_password] && u[:password] && u[:password_confirmation] if @user.update_with_password(u) password_changed = true flash[:notice] = I18n.t 'users.update.password_changed' else flash[:error] = I18n.t 'users.update.password_not_changed' end elsif u[:show_community_spotlight_in_stream] || u[:getting_started] if @user.update_attributes(u) flash[:notice] = I18n.t 'users.update.settings_updated' else flash[:notice] = I18n.t 'users.update.settings_not_updated' end elsif u[:language] if @user.update_attributes(u) I18n.locale = @user.language flash[:notice] = I18n.t 'users.update.language_changed' else flash[:error] = I18n.t 'users.update.language_not_changed' end elsif u[:email] @user.unconfirmed_email = u[:email] if @user.save @user.mail_confirm_email flash[:notice] = I18n.t 'users.update.unconfirmed_email_changed' else flash[:error] = I18n.t 'users.update.unconfirmed_email_not_changed' end elsif u[:auto_follow_back] if @user.update_attributes(u) flash[:notice] = I18n.t 'users.update.follow_settings_changed' else flash[:error] = I18n.t 'users.update.follow_settings_not_changed' end end elsif aspect_order = params[:reorder_aspects] @user.reorder_aspects(aspect_order) end respond_to do |format| format.js { render :nothing => true, :status => 204 } format.all { redirect_to password_changed ? new_user_session_path : edit_user_path } end end Monday, November 12, 12