-
-
Notifications
You must be signed in to change notification settings - Fork 144
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to automatically set the default logout_url
if DASH_LOGOUT_URL
exists in the environment as discussed at https://github.com/plotly/streambed/issues/11817#issuecomment-438801947?
I leave it up to the dash team to decide if this is worth doing, but without this all Dash Apps wanting to add a logout button on DDS will have to implement this so there's a good argument for centralizing it in dcc.
There is no python hooks for the components so we can't do it at the component level. Can add it from a dds app with |
That URL doesn't look so bad, except you'll want a default so it doesn't crash in test environments and for non-DDS users. So something like: Is it impossible to check |
The python component class is auto-generated, it will get overwritten when the components are regenerated. |
I realize that, but I'm surprised we don't have any control over the generation process or what goes into the component at that time. Anyway if my suggestion is unreasonable I'm OK leaving things as they are. |
W could have some kind of hooks, it's just not implemented right now. I created an issue: |
src/components/LogoutButton.react.js
Outdated
className="dash-logout-frame" | ||
> | ||
<button | ||
className={`dash-logout-btn ${className}`} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here if className
is undefined, it will add "undefined" to the class. Would be cleaner to check if className
exists before appending it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm getting 405
errors, saying "The method is not allowed for the requested URL.". Is there something we have to set-up in the underlying Flask server to allow for POST requests? Not sure why I'm getting these errors.
For the default url, how about adding it as a defaultProp
? You could even do a GET
instead of a POST
if there's no url set (and therefore uses the default "https://dash.plot.ly/docs_on_logout") so that it links you to those docs.
Lastly, requesting a small change having to do with appending the className
prop.
There's an example in the test: @app.server.route('/_logout', methods=['POST'])
def on_logout():
rep = flask.redirect('/logged-out')
rep.set_cookie('logout-cookie', '', 0)
return rep |
I'll make |
@T4rk1n Maybe add some more info (or a link to those docs) in the docstring for the component as well, so that it's more clear for users what this component is for. |
Great - looks good to me! |
Add a logout button, performs a form post request to a
logout_url
.