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

RDISCROWD-6112 Onboarding: Install local instance GIGwork #851

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@

app = create_app(run_as_server=False)

def create_su():
'''Create the first super user'''
with app.app_context():
from pybossa.core import user_repo
from pybossa.model.user import User
if not user_repo.get_all():
user = User(email_addr='user@user.com', name='user', fullname='user', admin=True)
user.set_password('test')
Copy link

@kbecker42 kbecker42 Jun 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am wondering if we should consider omitting this due to exposing the account credentials openly. We could instead opt to allow local installs to follow documentation for creating the accounts. Thoughts?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think that is a good suggestion. I was considering this change in the context of running a local dev environment, but this function is agnostic to that aspect and users may not adopt best practices and change the credentials in production.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just had a thought: we could also prompt the user for info like so:

fullname = input("Enter your full name: ")
email = input("Enter your email address: ")
name = input("Choose a username: ")
password = input("Choose a password: ")

Copy link

@kbecker42 kbecker42 Jun 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be reasonable Can we ensure that create_su() is only called manually by dev? Even just the password from input.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to Kory's suggestion

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering valid security concerns raised by Kory/Noor and since its only for local instance, this could be part of internal documentation rather than code.

user_repo.save(user)

def setup_alembic_config():
alembic_cfg = Config("alembic.ini")
command.stamp(alembic_cfg, "head")
Expand Down
Loading