GRN2-6: Added the ability for admins to specify registration method (#520)
* Added the ability to invite users * Small bug fix * Added the ability to approve/decline users * Small bug fixes * More bug fixes * More minor changes * Final changesv2
parent
adf4b68008
commit
720dac6012
@ -0,0 +1,54 @@ |
||||
# frozen_string_literal: true |
||||
|
||||
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/. |
||||
# |
||||
# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below). |
||||
# |
||||
# This program is free software; you can redistribute it and/or modify it under the |
||||
# terms of the GNU Lesser General Public License as published by the Free Software |
||||
# Foundation; either version 3.0 of the License, or (at your option) any later |
||||
# version. |
||||
# |
||||
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY |
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
||||
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU Lesser General Public License along |
||||
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. |
||||
|
||||
module Registrar |
||||
extend ActiveSupport::Concern |
||||
|
||||
def registration_method |
||||
Setting.find_or_create_by!(provider: user_settings_provider).get_value("Registration Method") |
||||
end |
||||
|
||||
def open_registration |
||||
registration_method == Rails.configuration.registration_methods[:open] |
||||
end |
||||
|
||||
def approval_registration |
||||
registration_method == Rails.configuration.registration_methods[:approval] |
||||
end |
||||
|
||||
def invite_registration |
||||
registration_method == Rails.configuration.registration_methods[:invite] |
||||
end |
||||
|
||||
# Returns a hash containing whether the user has been invited and if they |
||||
# signed up with the same email that they were invited with |
||||
def check_user_invited(email, token, domain) |
||||
return { present: true, verified: false } unless invite_registration |
||||
return { present: false, verified: false } if token.nil? |
||||
|
||||
invite = Invitation.valid.find_by(invite_token: token, provider: domain) |
||||
if invite.present? |
||||
# Check if they used the same email to sign up |
||||
same_email = email.casecmp(invite.email).zero? |
||||
invite.destroy |
||||
{ present: true, verified: same_email } |
||||
else |
||||
{ present: false, verified: false } |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,23 @@ |
||||
# frozen_string_literal: true |
||||
|
||||
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/. |
||||
# |
||||
# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below). |
||||
# |
||||
# This program is free software; you can redistribute it and/or modify it under the |
||||
# terms of the GNU Lesser General Public License as published by the Free Software |
||||
# Foundation; either version 3.0 of the License, or (at your option) any later |
||||
# version. |
||||
# |
||||
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY |
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
||||
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU Lesser General Public License along |
||||
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. |
||||
|
||||
class Invitation < ApplicationRecord |
||||
has_secure_token :invite_token |
||||
|
||||
scope :valid, -> { where(updated_at: (Time.now - 48.hours)..Time.now) } |
||||
end |
@ -0,0 +1,44 @@ |
||||
<% |
||||
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/. |
||||
# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below). |
||||
# This program is free software; you can redistribute it and/or modify it under the |
||||
# terms of the GNU Lesser General Public License as published by the Free Software |
||||
# Foundation; either version 3.0 of the License, or (at your option) any later |
||||
# version. |
||||
# |
||||
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY |
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
||||
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
||||
# You should have received a copy of the GNU Lesser General Public License along |
||||
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. |
||||
%> |
||||
|
||||
<div class="modal fade" id="inviteModal" tabindex="-1" role="dialog"> |
||||
<div class="modal-dialog modal-dialog-centered" role="document"> |
||||
<div class="modal-content text-center"> |
||||
<div class="modal-body"> |
||||
<div class="card-body p-6"> |
||||
<div class="card-title"> |
||||
<h3><%= t("modal.invite_user.title") %></h3> |
||||
</div> |
||||
|
||||
<%= form_for(:invite_user, url: invite_user_path) do |f| %> |
||||
<div class="input-icon mb-2"> |
||||
<span class="input-icon-addon"> |
||||
<i class="fas fa-envelope"></i> |
||||
</span> |
||||
<%= f.text_field :email, class: "form-control", value: "", placeholder: t("modal.invite_user.email_placeholder"), autocomplete: :off %> |
||||
<div class="invalid-feedback text-left"><%= t("modal.invite_user.not_blank") %></div> |
||||
</div> |
||||
<div class="mt-4"> |
||||
<%= f.submit t("modal.invite_user.send"), class:"btn btn-primary btn-block" %> |
||||
</div> |
||||
<% end %> |
||||
</div> |
||||
<div class="card-footer"> |
||||
<p><%= t("modal.invite_user.footer") %></p> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
@ -0,0 +1,43 @@ |
||||
<% |
||||
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/. |
||||
# |
||||
# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below). |
||||
# |
||||
# This program is free software; you can redistribute it and/or modify it under the |
||||
# terms of the GNU Lesser General Public License as published by the Free Software |
||||
# Foundation; either version 3.0 of the License, or (at your option) any later |
||||
# version. |
||||
# |
||||
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY |
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
||||
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU Lesser General Public License along |
||||
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. |
||||
%> |
||||
|
||||
<div style="text-align:center; font-family:'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif"> |
||||
<div style="display:inline-block; background-color:#F5F7FB; border:1px solid #d3d3d3; padding: 25px 70px"> |
||||
<%= image_tag(@image, height: '70') %> |
||||
|
||||
<h1 style="margin-bottom:30px"> |
||||
<%= t('mailer.user.approve.subject') %> |
||||
</h1> |
||||
|
||||
<p> |
||||
<%= t('mailer.user.approve.info') %> |
||||
</p> |
||||
|
||||
<p> |
||||
<%= t('mailer.user.approve.username', email: @user.email) %> |
||||
</p> |
||||
|
||||
<p style="margin-bottom:35px;"> |
||||
<%= t('mailer.user.approve.signin') %> |
||||
</p> |
||||
|
||||
<a style="background: <%= @color %>;color: #ffffff; padding: 10px 15px; box-shadow: 0 2px 4px 0 rgba(0,0,0,.25);border: 1px solid transparent;text-decoration:none;" href="<%= @url %>"> |
||||
<%= t('mailer.user.approve.signin_link') %> |
||||
</a> |
||||
</div> |
||||
</div> |
@ -0,0 +1,27 @@ |
||||
<% |
||||
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/. |
||||
# |
||||
# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below). |
||||
# |
||||
# This program is free software; you can redistribute it and/or modify it under the |
||||
# terms of the GNU Lesser General Public License as published by the Free Software |
||||
# Foundation; either version 3.0 of the License, or (at your option) any later |
||||
# version. |
||||
# |
||||
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY |
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
||||
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU Lesser General Public License along |
||||
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. |
||||
%> |
||||
|
||||
<%= t('mailer.user.approve.subject') %> |
||||
|
||||
<%= t('mailer.user.approve.info') %> |
||||
|
||||
<%= t('mailer.user.approve.username', email: @user.email) %> |
||||
|
||||
<%= t('mailer.user.approve.signin') %> |
||||
|
||||
<%= @url %> |
@ -0,0 +1,43 @@ |
||||
<% |
||||
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/. |
||||
# |
||||
# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below). |
||||
# |
||||
# This program is free software; you can redistribute it and/or modify it under the |
||||
# terms of the GNU Lesser General Public License as published by the Free Software |
||||
# Foundation; either version 3.0 of the License, or (at your option) any later |
||||
# version. |
||||
# |
||||
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY |
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
||||
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU Lesser General Public License along |
||||
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. |
||||
%> |
||||
|
||||
<div style="text-align:center; font-family:'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif"> |
||||
<div style="display:inline-block; background-color:#F5F7FB; border:1px solid #d3d3d3; padding: 25px 70px"> |
||||
<%= image_tag(@image, height: '70') %> |
||||
|
||||
<h1 style="margin-bottom:30px"> |
||||
<%= t('mailer.user.invite.subject') %> |
||||
</h1> |
||||
|
||||
<p> |
||||
<%= t('mailer.user.invite.info', name: @name) %> |
||||
</p> |
||||
|
||||
<p> |
||||
<%= t('mailer.user.invite.username', email: @email) %> |
||||
</p> |
||||
|
||||
<p style="margin-bottom:35px;"> |
||||
<%= t('mailer.user.invite.signup') %> |
||||
</p> |
||||
|
||||
<a style="background: <%= @color %>;color: #ffffff; padding: 10px 15px; box-shadow: 0 2px 4px 0 rgba(0,0,0,.25);border: 1px solid transparent;text-decoration:none;" href="<%= @url %>"> |
||||
<%= t('mailer.user.invite.signup_link') %> |
||||
</a> |
||||
</div> |
||||
</div> |
@ -0,0 +1,27 @@ |
||||
<% |
||||
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/. |
||||
# |
||||
# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below). |
||||
# |
||||
# This program is free software; you can redistribute it and/or modify it under the |
||||
# terms of the GNU Lesser General Public License as published by the Free Software |
||||
# Foundation; either version 3.0 of the License, or (at your option) any later |
||||
# version. |
||||
# |
||||
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY |
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
||||
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU Lesser General Public License along |
||||
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. |
||||
%> |
||||
|
||||
<%= t('mailer.user.invite.subject') %> |
||||
|
||||
<%= t('mailer.user.invite.info', name: @name) %> |
||||
|
||||
<%= t('mailer.user.invite.username', email: @email) %> |
||||
|
||||
<%= t('mailer.user.invite.signup') %> |
||||
|
||||
<%= @url %> |
@ -0,0 +1,12 @@ |
||||
# frozen_string_literal: true |
||||
|
||||
class CreateInvitations < ActiveRecord::Migration[5.0] |
||||
def change |
||||
create_table :invitations do |t| |
||||
t.string "email", null: false |
||||
t.string "provider", null: false |
||||
t.string "invite_token" |
||||
t.timestamps |
||||
end |
||||
end |
||||
end |