|
1
|
|
|
# frozen_string_literal: true |
|
2
|
|
|
|
|
3
|
|
|
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/. |
|
4
|
|
|
# |
|
5
|
|
|
# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below). |
|
6
|
|
|
# |
|
7
|
|
|
# This program is free software; you can redistribute it and/or modify it under the |
|
8
|
|
|
# terms of the GNU Lesser General Public License as published by the Free Software |
|
9
|
|
|
# Foundation; either version 3.0 of the License, or (at your option) any later |
|
10
|
|
|
# version. |
|
11
|
|
|
# |
|
12
|
|
|
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY |
|
13
|
|
|
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
|
14
|
|
|
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
|
15
|
|
|
# |
|
16
|
|
|
# You should have received a copy of the GNU Lesser General Public License along |
|
17
|
|
|
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. |
|
18
|
|
|
|
|
19
|
|
|
module Emailer |
|
20
|
|
|
extend ActiveSupport::Concern |
|
21
|
|
|
|
|
22
|
|
|
# Sends account activation email. |
|
23
|
|
|
def send_activation_email(user) |
|
24
|
|
|
@user = user |
|
25
|
|
|
UserMailer.verify_email(@user, user_verification_link, logo_image, user_color).deliver |
|
26
|
|
|
end |
|
27
|
|
|
|
|
28
|
|
|
# Sends password reset email. |
|
29
|
|
|
def send_password_reset_email(user) |
|
30
|
|
|
@user = user |
|
31
|
|
|
UserMailer.password_reset(@user, reset_link, logo_image, user_color).deliver_now |
|
32
|
|
|
end |
|
33
|
|
|
|
|
34
|
|
|
# Sends inivitation to join |
|
35
|
|
|
def send_invitation_email(name, email, token) |
|
36
|
|
|
@token = token |
|
37
|
|
|
UserMailer.invite_email(name, email, invitation_link, logo_image, user_color).deliver_now |
|
38
|
|
|
end |
|
39
|
|
|
|
|
40
|
|
|
def send_user_approved_email(user) |
|
41
|
|
|
UserMailer.approve_user(user, root_url, logo_image, user_color).deliver_now |
|
42
|
|
|
end |
|
43
|
|
|
|
|
44
|
|
|
private |
|
45
|
|
|
|
|
46
|
|
|
# Returns the link the user needs to click to verify their account |
|
47
|
|
|
def user_verification_link |
|
48
|
|
|
edit_account_activation_url(token: @user.activation_token, email: @user.email) |
|
49
|
|
|
end |
|
50
|
|
|
|
|
51
|
|
|
def reset_link |
|
52
|
|
|
edit_password_reset_url(@user.reset_token, email: @user.email) |
|
53
|
|
|
end |
|
54
|
|
|
|
|
55
|
|
|
def invitation_link |
|
56
|
|
|
if allow_greenlight_users? |
|
57
|
|
|
signup_url(invite_token: @token) |
|
58
|
|
|
else |
|
59
|
|
|
root_url(invite_token: @token) |
|
60
|
|
|
end |
|
61
|
|
|
end |
|
62
|
|
|
end |
|
63
|
|
|
|