Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Greenlight
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Arbeitsgruppe Hardwarenahe IT-Systeme
Greenlight
Commits
166a5728
Unverified
Commit
166a5728
authored
1 year ago
by
Ahmad Farhat
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Remove reset password rake task (#5557)
parent
2d369dac
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/tasks/reset_password_email.rake
+0
-58
0 additions, 58 deletions
lib/tasks/reset_password_email.rake
with
0 additions
and
58 deletions
lib/tasks/reset_password_email.rake
deleted
100644 → 0
+
0
−
58
View file @
2d369dac
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/.
#
# Copyright (c) 2022 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.
#
# Greenlight 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 Greenlight; if not, see <http://www.gnu.org/licenses/>.
# frozen_string_literal: true
require_relative
'task_helpers'
namespace
:migration
do
batch_size
=
500
desc
'Send a reset password email to users'
task
:reset_password_email
,
%i[base_url provider]
=>
:environment
do
|
_task
,
args
|
args
.
with_defaults
(
provider:
'greenlight'
)
root_url
=
"
#{
args
[
:base_url
]
}
/"
if
ENV
[
'SMTP_SERVER'
].
blank?
err
'SMTP Server not set. Skipping sending reset password emails.'
exit
0
end
info
'Sending reset password emails...'
User
.
where
(
external_id:
nil
,
provider:
args
[
:provider
])
.
find_each
(
batch_size
:)
do
|
user
|
token
=
user
.
generate_reset_token!
UserMailer
.
with
(
user
:,
reset_url:
reset_password_url
(
root_url
,
token
),
base_url:
args
[
:base_url
],
provider:
args
[
:provider
]).
reset_password_email
.
deliver_now
success
'Successfully sent reset password email to:'
info
" name:
#{
user
.
name
}
"
info
" email:
#{
user
.
email
}
"
rescue
StandardError
=>
e
err
"Unable to send reset password email to:
\n
name:
#{
user
.
name
}
\n
email:
#{
user
.
email
}
\n
error:
#{
e
}
"
end
end
private
def
reset_password_url
(
root_url
,
token
)
"
#{
root_url
}
reset_password/
#{
token
}
"
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment