mirror of https://github.com/CIRCL/AIL-framework
34 lines
987 B
Python
Executable File
34 lines
987 B
Python
Executable File
#!/usr/bin/env python3
|
|
# -*-coding:UTF-8 -*
|
|
|
|
import os
|
|
import sys
|
|
import redis
|
|
|
|
sys.path.append(os.environ['AIL_BIN'])
|
|
##################################
|
|
# Import Project packages
|
|
##################################
|
|
from lib import Users
|
|
|
|
if __name__ == "__main__":
|
|
|
|
# create role_list
|
|
Users._create_roles_list()
|
|
|
|
user_id = 'admin@admin.test'
|
|
password = Users.gen_password()
|
|
|
|
create_user(user_id, password=password, role='admin')
|
|
token = Users.get_default_admin_token()
|
|
|
|
default_passwd_file = os.path.join(os.environ['AIL_HOME'], 'DEFAULT_PASSWORD')
|
|
to_write_str = '# Password Generated by default\n# This file is deleted after the first login\n#\nemail=admin@admin.test\npassword='
|
|
to_write_str = f'{to_write_str}{password}\nAPI_Key={token}\n'
|
|
with open(default_passwd_file, 'w') as f:
|
|
f.write(to_write_str)
|
|
|
|
print('new user created: {}'.format(user_id))
|
|
print('password: {}'.format(password))
|
|
print('token: {}'.format(token))
|