gaw89 / dash-flask-login

A plugin to integrate Dash and Flask-Login
MIT License
56 stars 17 forks source link

some problem need help #4

Open sylvoslee opened 6 years ago

sylvoslee commented 6 years ago

HI gaw89: When i add some logic in login function,it doesn't work properly,for exsample,time.sleep(3) `# This callback to the login app should encapsulate the login functionality

Set the output to a non-visible location

@login_app.callback(
            Output('h1', 'n_clicks'),
            [Input('submit-button', 'n_clicks')],
            [State('uname-box', 'value'),
             State('pwd-box', 'value')]
        )
def login(n_clicks, uname, pwd):
     sql='select password from users where user=%s'
     params=[uname]
     cu.execute(sql,params)
     password=cu.fetchone()
     if uname == 'user' and pwd == 'password':
         login_user(load_user(users[0].name))

     else:pass
gaw89 commented 6 years ago

@sylvoslee What actually happens when you use this code? Does it produce an error? Does it just not log you in? If you can provide more detail, I'll see what I can do.

Thanks!