Skip to content

Commit bbdb5e6

Browse files
ensure user reads privacy policy before creating account
1 parent e7bceba commit bbdb5e6

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

app.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ def toggle_gdpr_policy_modal(n_clicks):
5959
return callback_utils.toggle_modal(trigger)
6060

6161

62+
@app.callback(Output('create-user-button', 'disabled'),
63+
[Input('gdpr-agreement-checkbox', 'checked')],
64+
[State('create-user-button', 'disabled')])
65+
def toggle_createuser_button(checked, disabled):
66+
trigger = dash.callback_context.triggered[0]
67+
return callback_utils.toggle_createuserbutton(trigger, disabled)
68+
69+
6270
@app.callback(Output({'type': 'tutorial-modal', 'index': MATCH}, 'is_open'),
6371
[Input({'type': 'tutorial-button', 'index': MATCH}, 'n_clicks')])
6472
def toggle_tutorial_modal(n_clicks):

components/cards.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,9 +325,7 @@ def CreateUserCard():
325325
components.GdprAgreementCheckbox(),
326326
html.Br(),
327327
dbc.Button("Create new user", color="primary", block=True, id='create-user-button', disabled=True),
328-
html.Br(),
329328
]),
330-
dbc.CardFooter([components.GdprPolicyModal(), components.GdprPolicyAlert()])
331329
])
332330

333331

utils/callback_utils.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ def toggle_modal(trigger):
2525
return True
2626

2727

28+
def toggle_createuserbutton(trigger, disabled):
29+
if not ensure_triggered(trigger):
30+
return no_update
31+
return not disabled
32+
33+
2834
def toggle_selection_alert(format_selection):
2935
if format_selection is not None:
3036
return None, False

0 commit comments

Comments
 (0)