diff --git a/app/controllers/static_controller.rb b/app/controllers/static_controller.rb index a018f9874..031df4706 100644 --- a/app/controllers/static_controller.rb +++ b/app/controllers/static_controller.rb @@ -1,6 +1,11 @@ class StaticController < ApplicationController def terms_of_service end + + def accept_terms_of_service + cookies.permanent[:accepted_tos] = "1" + redirect_to(params[:url] || posts_path) + end def error end diff --git a/app/views/layouts/default.html.erb b/app/views/layouts/default.html.erb index 479681eac..97620c8ba 100644 --- a/app/views/layouts/default.html.erb +++ b/app/views/layouts/default.html.erb @@ -44,7 +44,7 @@ <%= render "users/upgrade_notice" %> <% end %> - <% if !CurrentUser.is_privileged? && CurrentUser.user.created_at > 2.weeks.ago %> + <% if cookies["accepted_tos"].blank? && !CurrentUser.is_privileged? %> <%= render "users/tos" %> <% end %> diff --git a/app/views/static/terms_of_service.html.erb b/app/views/static/terms_of_service.html.erb index 81cb2d859..0ed4aec0e 100644 --- a/app/views/static/terms_of_service.html.erb +++ b/app/views/static/terms_of_service.html.erb @@ -50,6 +50,11 @@
Danbooru will not disclose the IP address, email address, password, or DMails of any user except to the staff.
Danbooru is allowed to make public everything else, including but not limited to: uploaded posts, favorited posts, comments, forum posts, wiki edits, and note edits.
+ + <%= form_tag(accept_terms_of_service_path) do %> + <%= hidden_field_tag :url, params[:url] %> + <%= submit_tag "I have read and agree to these rules" %> + <% end %> <% content_for(:page_title) do %> diff --git a/app/views/users/_tos.html.erb b/app/views/users/_tos.html.erb index f0df1d8d2..e323724d2 100644 --- a/app/views/users/_tos.html.erb +++ b/app/views/users/_tos.html.erb @@ -1,3 +1,3 @@