Basic login with modal

Hello @amihaio,

Yes, you would use this as a session dcc.Store.

Use the dcc.Store as a state, and if empty, then tell the modal to open. If it isnt empty then pass no_update as the open value.

If the user closes and reopens the browser, then they will need to relogin. When using local this would stay on the device until their clear their cache.

I’d also allow the user to switch users manually too by allowing the modal to be opened on a button click as well.

@callback(
Output(modal, 'is_opened'),
Input(login, 'n_clicks'),
State(user, 'data')
)
def display_login(n, d):
   if n > 0 or not d:
       return True
   return no_update