mirror of
https://github.com/TracksApp/tracks.git
synced 2025-09-22 05:50:47 +02:00
Add functionality for requiring TOS approval on signup
This commit is contained in:
parent
2781395405
commit
5a3727dc5f
6 changed files with 36 additions and 5 deletions
|
@ -19,10 +19,16 @@ body {
|
||||||
@include make-sm-column-offset(3);
|
@include make-sm-column-offset(3);
|
||||||
margin: 2em auto 1em;
|
margin: 2em auto 1em;
|
||||||
background-color: rgba(0, 0, 0, 0.75);
|
background-color: rgba(0, 0, 0, 0.75);
|
||||||
color: #eaeaea;
|
|
||||||
padding: 0 0 1em 0;
|
padding: 0 0 1em 0;
|
||||||
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5), 0 2px 3px rgba(0, 0, 0, 0.3);
|
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5), 0 2px 3px rgba(0, 0, 0, 0.3);
|
||||||
|
color: #eaeaea;
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #eaeaea;
|
||||||
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@media(min-width: $screen-sm-min) {
|
@media(min-width: $screen-sm-min) {
|
||||||
.login-box {
|
.login-box {
|
||||||
|
|
|
@ -76,10 +76,14 @@ class UsersController < ApplicationController
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
unless params['approve_tos'] == 'on' || SITE_CONFIG['tos_link'].blank?
|
||||||
|
render_failure "You have to accept the terms of service to sign up!"
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
user = User.new(user_params)
|
user = User.new(user_params)
|
||||||
|
|
||||||
unless user.valid?
|
unless user.valid?
|
||||||
session['new_user'] = user
|
|
||||||
redirect_to signup_path
|
redirect_to signup_path
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -106,6 +110,11 @@ class UsersController < ApplicationController
|
||||||
render_failure "Expected post format is valid xml like so: <user><login>username</login><password>abc123</password></user>.", 400
|
render_failure "Expected post format is valid xml like so: <user><login>username</login><password>abc123</password></user>.", 400
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
unless user_params['approve_tos'] == 'on' || SITE_CONFIG['tos_link'].blank?
|
||||||
|
render_failure "You have to accept the terms of service to sign up!"
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
user = User.new(user_params)
|
user = User.new(user_params)
|
||||||
user.password_confirmation = user_params[:password]
|
user.password_confirmation = user_params[:password]
|
||||||
saved = user.save
|
saved = user.save
|
||||||
|
|
|
@ -20,16 +20,25 @@
|
||||||
|
|
||||||
<div class="label-element-combo">
|
<div class="label-element-combo">
|
||||||
<%= label_tag "user_login", t('users.desired_login') %>
|
<%= label_tag "user_login", t('users.desired_login') %>
|
||||||
<%= text_field_tag "user_login", nil, class: "form-control" %>
|
<%= text_field "user", "login", class: "form-control" %>
|
||||||
</div>
|
</div>
|
||||||
<div class="label-element-combo">
|
<div class="label-element-combo">
|
||||||
<%= label_tag "user_password", t('users.choose_password') %>
|
<%= label_tag "user_password", t('users.choose_password') %>
|
||||||
<%= password_field_tag "user_password", nil, class: "form-control" %>
|
<%= password_field "user", "password", class: "form-control" %>
|
||||||
</div>
|
</div>
|
||||||
<div class="label-element-combo">
|
<div class="label-element-combo">
|
||||||
<%= label_tag "user_password_confirmation", t('users.confirm_password') %>
|
<%= label_tag "user_password_confirmation", t('users.confirm_password') %>
|
||||||
<%= password_field_tag "user_password_confirmation", nil, class: "form-control" %>
|
<%= password_field "user", "password_confirmation", class: "form-control" %>
|
||||||
</div>
|
</div>
|
||||||
|
<% unless SITE_CONFIG['tos_link'].blank? -%>
|
||||||
|
<div class="label-element-combo">
|
||||||
|
<div class="checkbox">
|
||||||
|
<input name="approve_tos" id="approve_tos" type="checkbox" />
|
||||||
|
<label for="approve_tos"><%= t("users.approve_tos") %></label>
|
||||||
|
(<a href="<%= SITE_CONFIG['tos_link'] %>"><%= t('users.tos_link') %></a>)
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end -%>
|
||||||
<%= submit_tag t("users.signup"), class: "btn btn-default" %>
|
<%= submit_tag t("users.signup"), class: "btn btn-default" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -978,6 +978,8 @@ en:
|
||||||
change_authentication_type: Change authentication type
|
change_authentication_type: Change authentication type
|
||||||
total_notes: Total notes
|
total_notes: Total notes
|
||||||
select_authentication_type: Select your new authentication type and click 'Change authentication type' to replace your current settings.
|
select_authentication_type: Select your new authentication type and click 'Change authentication type' to replace your current settings.
|
||||||
|
approve_tos: I approve the Terms of Service
|
||||||
|
tos_link: read the Terms of Service
|
||||||
feedlist:
|
feedlist:
|
||||||
choose_context: Choose the context you want a feed of
|
choose_context: Choose the context you want a feed of
|
||||||
actions_due_today: Actions due today or earlier
|
actions_due_today: Actions due today or earlier
|
||||||
|
|
|
@ -42,6 +42,9 @@ force_ssl: false
|
||||||
# Set to true to allow anyone to sign up for a username.
|
# Set to true to allow anyone to sign up for a username.
|
||||||
open_signups: false
|
open_signups: false
|
||||||
|
|
||||||
|
# Set to require TOS approval on signup.
|
||||||
|
#tos_link: "https://www.example.com"
|
||||||
|
|
||||||
# When integrating your tracks instance with http://cloudmailin.com/ by using
|
# When integrating your tracks instance with http://cloudmailin.com/ by using
|
||||||
# the /integrations/cloudmailin URL, this value is the cloudmailin-secret for
|
# the /integrations/cloudmailin URL, this value is the cloudmailin-secret for
|
||||||
# verifying the authenticity of the request.
|
# verifying the authenticity of the request.
|
||||||
|
|
|
@ -48,6 +48,8 @@ force_ssl: false
|
||||||
# Set to true to allow anyone to sign up for a username.
|
# Set to true to allow anyone to sign up for a username.
|
||||||
open_signups: false
|
open_signups: false
|
||||||
|
|
||||||
|
# Set to require TOS approval on signup.
|
||||||
|
#tos_link: "https://www.example.com"
|
||||||
|
|
||||||
# When integrating your tracks instance with http://cloudmailin.com/ by using
|
# When integrating your tracks instance with http://cloudmailin.com/ by using
|
||||||
# the /integrations/cloudmailin URL, this value is the cloudmailin-secret for
|
# the /integrations/cloudmailin URL, this value is the cloudmailin-secret for
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue