mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
additional setup on initial user
This commit is contained in:
parent
3f0799a1c4
commit
686beda67a
1 changed files with 9 additions and 1 deletions
10
app/cli.py
10
app/cli.py
|
@ -129,10 +129,18 @@ def register(app):
|
|||
email = input("Admin email address: ")
|
||||
password = input("Admin password: ")
|
||||
verification_token = random_token(16)
|
||||
admin_user = User(user_name=user_name, email=email, verification_token=verification_token)
|
||||
private_key, public_key = RsaKeys.generate_keypair()
|
||||
admin_user = User(user_name=user_name, title=user_name,
|
||||
email=email, verification_token=verification_token,
|
||||
instance_id=1, email_unread_sent=False,
|
||||
private_key=private_key, public_key=public_key)
|
||||
admin_user.set_password(password)
|
||||
admin_user.roles.append(admin_role)
|
||||
admin_user.verified = True
|
||||
admin_user.last_seen = utcnow()
|
||||
admin_user.ap_profile_id = f"https://{current_app.config['SERVER_NAME']}/u/{admin_user.user_name}"
|
||||
admin_user.ap_public_url = f"https://{current_app.config['SERVER_NAME']}/u/{admin_user.user_name}"
|
||||
admin_user.ap_inbox_url = f"https://{current_app.config['SERVER_NAME']}/u/{admin_user.user_name}/inbox"
|
||||
db.session.add(admin_user)
|
||||
|
||||
db.session.commit()
|
||||
|
|
Loading…
Reference in a new issue