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

Duplicate Superuser with same email #172

Open
harkaranbrar7 opened this issue Sep 29, 2021 · 0 comments
Open

Duplicate Superuser with same email #172

harkaranbrar7 opened this issue Sep 29, 2021 · 0 comments

Comments

@harkaranbrar7
Copy link


from app.db.session import get_db
from app.db.crud import create_user, get_user_by_email
from app.db.schemas import UserCreate
from app.db.session import SessionLocal


def init() -> None:
    db = SessionLocal()
    user = get_user_by_email(db, email="{{cookiecutter.superuser_email}}")

    if not user:
        create_user(
            db,
            UserCreate(
                email="{{cookiecutter.superuser_email}}",
                password="{{cookiecutter.superuser_password}}",
                is_active=True,
                is_superuser=True,
            ),
        )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant