Class: Decidim::TosController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/decidim/tos_controller.rb

Overview

The controller to handle the current user's Terms of service agreement.

Instance Method Summary collapse

Instance Method Details

#accept_tosObject



9
10
11
12
13
14
15
16
17
18
# File '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_of_service")
    redirect_to  current_user
  else
    flash[:alert] = t("accept.error", scope: "decidim.pages.terms_of_service")
    redirect_to decidim.page_path tos_page
  end
end