let plugins require (and customize) terms checkbox on cc confirm page
refs #CNVS-2297, #CNVS-1318, #CNVS-1301 test plan: 1. sign up via open registration (/register) 2. go to the link in your email to set a password 3. you should not have to agree to the terms again (since you did on the /register page) 4. refer to plugin test plan for other scenarios Change-Id: Ie31a3424c9a8126e4c28e794b1a96da6faa7382c Reviewed-on: https://gerrit.instructure.com/16294 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Joe Tanner <joe@instructure.com> QA-Review: Cam Theriault <cam@instructure.com>
This commit is contained in:
parent
2829923411
commit
bc15ef9b99
|
@ -258,6 +258,7 @@ class CommunicationChannelsController < ApplicationController
|
|||
if Canvas.redis_enabled? && @merge_opportunities.length == 1
|
||||
Canvas.redis.rpush('single_user_registered_new_account_stats', {:user_id => @user.id, :registered_at => Time.now.utc }.to_json)
|
||||
end
|
||||
@user.require_acceptance_of_terms = require_terms?
|
||||
@user.attributes = params[:user]
|
||||
@pseudonym.attributes = params[:pseudonym]
|
||||
@pseudonym.communication_channel = cc
|
||||
|
@ -266,7 +267,7 @@ class CommunicationChannelsController < ApplicationController
|
|||
@pseudonym.require_password = true
|
||||
@pseudonym.password_confirmation = @pseudonym.password = params[:pseudonym][:password] if params[:pseudonym]
|
||||
|
||||
return unless @pseudonym.valid?
|
||||
return unless @pseudonym.valid? && @user.valid?
|
||||
|
||||
# They may have switched e-mail address when they logged in; create a CC if so
|
||||
if @pseudonym.unique_id != cc.path
|
||||
|
@ -362,4 +363,10 @@ class CommunicationChannelsController < ApplicationController
|
|||
@user == @current_user ||
|
||||
@user.grants_right?(@current_user, session, :manage_user_details)
|
||||
end
|
||||
|
||||
def require_terms?
|
||||
# a plugin could potentially set this
|
||||
@require_terms
|
||||
end
|
||||
helper_method :require_terms?
|
||||
end
|
||||
|
|
|
@ -794,4 +794,12 @@ module ApplicationHelper
|
|||
uri = 'http://' + uri if noSchemeName
|
||||
uri
|
||||
end
|
||||
|
||||
def agree_to_terms
|
||||
# may be overridden by a plugin
|
||||
@agree_to_terms ||
|
||||
t("#user.registration.agree_to_terms",
|
||||
"You agree to the *terms of use*.",
|
||||
:wrapper => link_to('\1', "http://www.instructure.com/terms-of-use", :target => "_new"))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -23,11 +23,4 @@ module SelfEnrollmentsHelper
|
|||
markdown(@registration_summary, :never) rescue nil
|
||||
end
|
||||
end
|
||||
|
||||
def agree_to_terms
|
||||
@agree_to_terms ||
|
||||
t("#self_enrollments.agree_to_terms",
|
||||
"You agree to the *terms of use*.",
|
||||
:wrapper => link_to('\1', "http://www.instructure.com/terms-of-use", :target => "_new"))
|
||||
end
|
||||
end
|
|
@ -98,7 +98,7 @@ Which is you?", :count => @merge_opportunities.length %>
|
|||
<% end %>
|
||||
|
||||
<% if @pseudonym %>
|
||||
<% form_for :pseudonym, :url => registration_confirmation_url(@nonce, :enrollment => @enrollment.try(:uuid)), :html => {:id => "registration_confirmation_form", :class => 'form-horizontal bootstrap-form', :style => ((!@merge_opportunities.empty? || @enrollment) && !params[:register]) ? hidden : '' } do |form| %>
|
||||
<% form_for :pseudonym, :url => registration_confirmation_url(@nonce, request.query_parameters), :html => {:id => "registration_confirmation_form", :class => 'form-horizontal bootstrap-form', :style => ((!@merge_opportunities.empty? || @enrollment) && !params[:register]) ? hidden : '' } do |form| %>
|
||||
<p class="instructions"><%= if @enrollment
|
||||
mt 'details.register_with_course', "In order to finish signing you up for the course **%{course}**, we'll need a little more information.", :course => @course.name
|
||||
else
|
||||
|
@ -138,6 +138,16 @@ Which is you?", :count => @merge_opportunities.length %>
|
|||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if require_terms? %>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label for="user_terms_of_use">
|
||||
<%= check_box :user, :terms_of_use, :checked => true %>
|
||||
<%= agree_to_terms %>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<% unless @merge_opportunities.empty? %>
|
||||
|
|
|
@ -27,6 +27,7 @@ describe "communication_channels/confirm.html.erb" do
|
|||
assigns[:nonce] = @cc.confirmation_code
|
||||
assigns[:body_classes] = []
|
||||
assigns[:root_account] = Account.default
|
||||
@controller.template.stubs(:require_terms?).returns(nil) # since controller-defined helper methods don't get plumbed down here
|
||||
end
|
||||
|
||||
shared_examples_for "user registration" do
|
||||
|
|
Loading…
Reference in New Issue