Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a way to configurate login_url and logout_url #6

Closed
vvlch opened this issue Oct 17, 2017 · 2 comments
Closed

Add a way to configurate login_url and logout_url #6

vvlch opened this issue Oct 17, 2017 · 2 comments

Comments

@vvlch
Copy link

@vvlch vvlch commented Oct 17, 2017

Hola! Thanks for the app, it's really cool, simple and time-saving.

I had a need to change some in-app variables (login_url, logout_url and home_url) and found it difficult because a method like this

sl = SimpleLogin(app)
sl.config['login_url'] = '/admin/login/'
sl.config['logout_url'] = '/admin/logout/'
sl.config['home_url'] = '/admin/'

isn't working (views for login and logout are already registered at __init__) and changing blueprint url rules after that is a bit too hard.

It would be great to have an ability to set this urls by writing something like this

SIMPLELOGIN_LOGIN_URL = '/admin/login/'
SIMPLELOGIN_LOGOUT_URL = '/admin/logout/'
SIMPLELOGIN_HOME_URL = '/admin/'

or this
SimpleLogin(app, login_url='/admin/login/', logout_url='/admin/logout/', 'home_url'='/admin/')

I could try to send a pull request, but not sure what method (or both) is better.

@rochacbruno
Copy link
Member

@rochacbruno rochacbruno commented Oct 17, 2017

Currently all app.config variables prefixed with SIMPLE_LOGIN_ are loaded here (before the views are registered)

https://github.com/rochacbruno/flask_simplelogin/blob/master/flask_simplelogin/__init__.py#L201

So, app.config['SIMPLE_LOGIN_HOME_URL'] will become sl.config['home_url']

and the same for login_url and logout_url

However now I see that we have inconsistency using SIMPLELOGIN and SIMPLE_LOGIN I would prefer to use only SIMPLELOGIN without the underline.

The fix is simply changing the https://github.com/rochacbruno/flask_simplelogin/blob/master/flask_simplelogin/__init__.py#L204 to use SIMPLELOGIN_

I am afraid it is going to break compatibility, but we can release a Major version.

Loading

@rochacbruno
Copy link
Member

@rochacbruno rochacbruno commented Sep 30, 2018

To fix this we should add a layer of backwards compatibility

Loading

cuducos added a commit that referenced this issue Oct 10, 2019
Avoids having SIMPLELOGIN_ for some cases and SIMPLE_LOGIN_ for other
cases (as described in #6).
cuducos added a commit that referenced this issue Oct 13, 2019
@cuducos cuducos closed this in 0717c8a Oct 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants