Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to recreate admin user? #850

Open
1 task done
Schi11ing opened this issue Jul 12, 2023 · 1 comment
Open
1 task done

how to recreate admin user? #850

Schi11ing opened this issue Jul 12, 2023 · 1 comment
Labels
type:question Further information is requested

Comments

@Schi11ing
Copy link

Schi11ing commented Jul 12, 2023

Environment information

  • MWDB version (from /about): 2.8.0

  • Installation method:

    • From PyPi (pip install mwdb-core)
  • Plugins installed:

Behaviour the bug (what happened?)

Expected behaviour

Reproduction Steps

Screenshots

Additional context

Hello!
Can you please help me?
I have installed mwdb-core in my dev-env and forgot admin password, i cannot use reset link because of dev-env without smtp server installed, so how can i recreate admin user with new password whithout using email reset link?

@psrok1 psrok1 added the type:question Further information is requested label Jul 20, 2023
@psrok1
Copy link
Member

psrok1 commented Jul 20, 2023

Hi!

There is no handy utility for that, but you can help yourself using Flask Python shell:

First enter mwdb-core shell

# mwdb-core shell
Python 3.8.17 (default, Jun 15 2023, 03:35:59) 
[GCC 12.2.1 20220924] on linux
App: mwdb.core.app
Instance: /app/instance
>>> 

Then use it to set password in database:

>>> 
from mwdb.model import db, User
admin = db.session.query(User).filter(User.login == "admin").first()
admin.set_password("yournewpassword")
db.session.add(admin)
db.session.commit()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants