Class: Decidim::TosController

Inherits:
ApplicationController show all
Defined in:
decidim-core/app/controllers/decidim/tos_controller.rb

Overview

The controller to handle the current user's Terms and Conditions agreement.

Instance Method Summary collapse

Methods included from UserBlockedChecker

#check_user_block_status, #check_user_not_blocked

Methods included from NeedsSnippets

#snippets

Methods included from HttpCachingDisabler

#disable_http_caching

Methods included from HasStoredPath

#skip_store_location?, #store_current_location

Methods included from RegistersPermissions

register_permissions

Methods included from NeedsOrganization

enhance_controller, extended, included

Instance Method Details

#accept_tosObject


9
10
11
12
13
14
15
16
17
18
# File 'decidim-core/app/controllers/decidim/tos_controller.rb', line 9

def accept_tos
  current_user.accepted_tos_version = Time.current
  if current_user.save!
    flash[:notice] = t("accept.success", scope: "decidim.pages.terms_and_conditions")
    redirect_to  current_user
  else
    flash[:alert] = t("accept.error", scope: "decidim.pages.terms_and_conditions")
    redirect_to decidim.page_path tos_page
  end
end