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

Open
valych opened this Issue Oct 17, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@valych

valych 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

This comment has been minimized.

Show comment
Hide comment
@rochacbruno

rochacbruno Oct 17, 2017

Owner

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.

Owner

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.

@rochacbruno rochacbruno self-assigned this Oct 17, 2017

@rochacbruno

This comment has been minimized.

Show comment
Hide comment
@rochacbruno

rochacbruno Sep 30, 2018

Owner

To fix this we should add a layer of backwards compatibility

Owner

rochacbruno commented Sep 30, 2018

To fix this we should add a layer of backwards compatibility

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment