mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 09:42:02 +08:00
DEV: Introduce users:exists rake task (#27163)
Checks if a user exists for given email address
This commit is contained in:
parent
ae1d8c50da
commit
0a2926ae03
|
@ -210,6 +210,17 @@ task "users:list_recent_staff" => :environment do
|
|||
puts "user_ids = [#{all_ids.uniq.join(",")}]"
|
||||
end
|
||||
|
||||
desc "Check if a user exists for given email address"
|
||||
task "users:exists", [:email] => [:environment] do |_, args|
|
||||
email = args[:email]
|
||||
if User.find_by_email(email)
|
||||
puts "User with email #{email} exists"
|
||||
exit 0
|
||||
end
|
||||
puts "ERROR: User with email #{email} not found"
|
||||
exit 1
|
||||
end
|
||||
|
||||
def find_user(username)
|
||||
user = User.find_by_username(username)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user