From 42f3f0262d06f50d730c55c232362c8ddd984d55 Mon Sep 17 00:00:00 2001 From: Hassan Abouelela Date: Fri, 17 Jun 2022 22:20:40 +0400 Subject: Enable Login Form In Production Adds a non-discoverable login form in all environments to make it easier to authenticate. Ideally, we'd have an actual login button, but this is an easy solution in the meantime. Signed-off-by: Hassan Abouelela --- backend/routes/forms/discover.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'backend/routes/forms/discover.py') diff --git a/backend/routes/forms/discover.py b/backend/routes/forms/discover.py index b993075..75ff495 100644 --- a/backend/routes/forms/discover.py +++ b/backend/routes/forms/discover.py @@ -11,25 +11,27 @@ from backend.route import Route from backend.validation import api __FEATURES = [ - constants.FormFeatures.DISCOVERABLE.value, constants.FormFeatures.OPEN.value, constants.FormFeatures.REQUIRES_LOGIN.value ] +if not constants.PRODUCTION: + __FEATURES.append(constants.FormFeatures.DISCOVERABLE.value) __QUESTION = Question( id="description", - name="Check your cookies after pressing the button.", + name="Click the button below to log into the forms application.", type="section", - data={"text": "You can find cookies under \"Application\" in dev tools."}, + data={"text": ""}, required=False ) -EMPTY_FORM = Form( - id="empty_auth", +AUTH_FORM = Form( + id="login", features=__FEATURES, questions=[__QUESTION], - name="Auth form", - description="An empty form to help you get a token.", + name="Login", + description="Log into Python Discord Forms.", + submitted_text="This page can't be submitted." ) @@ -55,7 +57,7 @@ class DiscoverableFormsList(Route): forms = [form.dict(admin=False) for form in forms] # Return an empty form in development environments to help with authentication. - if not forms and not constants.PRODUCTION: - forms.append(EMPTY_FORM.dict(admin=False)) + if not constants.PRODUCTION: + forms.append(AUTH_FORM.dict(admin=False)) return JSONResponse(forms) -- cgit v1.2.3