add dockerfiles
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import os
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
from account.models import AdminType, ProblemPermission, User, UserProfile
|
||||
@@ -9,18 +10,17 @@ class Command(BaseCommand):
|
||||
try:
|
||||
admin = User.objects.get(username="root")
|
||||
if admin.admin_type == AdminType.SUPER_ADMIN:
|
||||
self.stdout.write(self.style.WARNING("Super admin user 'root' already exists, "
|
||||
"would you like to reset it's password?\n"
|
||||
"Input yes to confirm: "))
|
||||
if input() == "yes":
|
||||
# todo remove this in product env
|
||||
# rand_password = rand_str(length=6)
|
||||
rand_password = "rootroot"
|
||||
admin.save()
|
||||
self.stdout.write(self.style.SUCCESS("Successfully created super admin user password.\n"
|
||||
"Username: root\nPassword: %s\n"
|
||||
"Remember to change password and turn on two factors auth "
|
||||
"after installation." % rand_password))
|
||||
if os.environ.get("OJ_ENV") != "production":
|
||||
self.stdout.write(self.style.WARNING("Super admin user 'root' already exists, "
|
||||
"would you like to reset it's password?\n"
|
||||
"Input yes to confirm: "))
|
||||
if input() == "yes":
|
||||
rand_password = "rootroot"
|
||||
admin.save()
|
||||
self.stdout.write(self.style.SUCCESS("Successfully created super admin user password.\n"
|
||||
"Username: root\nPassword: %s\n"
|
||||
"Remember to change password and turn on two factors auth "
|
||||
"after installation." % rand_password))
|
||||
else:
|
||||
self.stdout.write(self.style.SUCCESS("Nothing happened"))
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user