mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 04:31:10 +08:00
automatically make developers admins on account creation, this solves the user #1 problem
you can simply set the DEVELOPER_EMAILS to a comma delimited list and the users will be auto admined
This commit is contained in:
@ -63,9 +63,19 @@ class Auth::DefaultCurrentUserProvider
|
||||
user.save!
|
||||
end
|
||||
cookies.permanent[TOKEN_COOKIE] = { value: user.auth_token, httponly: true }
|
||||
make_developer_admin(user)
|
||||
@env[CURRENT_USER_KEY] = user
|
||||
end
|
||||
|
||||
def make_developer_admin(user)
|
||||
if user.active? &&
|
||||
!user.admin &&
|
||||
Rails.configuration.respond_to?(:developer_emails) &&
|
||||
Rails.configuration.developer_emails.include?(user.email)
|
||||
user.update_column(:admin, true)
|
||||
end
|
||||
end
|
||||
|
||||
def log_off_user(session, cookies)
|
||||
cookies[TOKEN_COOKIE] = nil
|
||||
end
|
||||
|
Reference in New Issue
Block a user