diff --git a/docs/conf.py b/docs/conf.py index d962ebd18e9362a6c7f3d122fdfa64757c299cf9..1ac53a28141aecb7d72f3ec6ec0cbf9f1fdfcb33 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -63,9 +63,9 @@ copyright = u'2014, Alexandre Ferland' # built documents. # # The short X.Y version. -version = '0.2.0' +version = '0.2.1' # The full version, including alpha/beta/rc tags. -release = '0.2.0' +release = '0.2.1' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/docs/index.rst b/docs/index.rst index 0080e37d45c765469a76e6f82585f82316582945..bdb1b2d29d9a3ff3ab5f1c28d769c4cffbbfa50c 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -108,6 +108,11 @@ History Changes: +- 0.2.1: January 6, 2015 + + - Fix Github issue `#10 `_, + Redirect users back to the page they originally requested after authenticating + - 0.2.0: December 7, 2014 - Added HTTP Basic Authentication. Thanks to OptiverTimAll on GitHub. diff --git a/flask_simpleldap/__init__.py b/flask_simpleldap/__init__.py index 74fdad55776d35f444ad2d0e648e42f55819e8d9..08e09638133dbdce3e0bcf262824cd0a1d4043e0 100644 --- a/flask_simpleldap/__init__.py +++ b/flask_simpleldap/__init__.py @@ -1,13 +1,11 @@ # -*- coding: utf-8 -*- __all__ = ['LDAP'] -from functools import wraps import re - import ldap -from ldap import filter -from flask import abort, current_app, g, make_response, redirect, url_for, \ - request +import ldap.filter +from functools import wraps +from flask import abort, current_app, g, make_response, redirect, url_for, request try: from flask import _app_ctx_stack as stack @@ -252,7 +250,7 @@ class LDAP(object): @wraps(func) def wrapped(*args, **kwargs): if g.user is None: - return redirect(url_for(current_app.config['LDAP_LOGIN_VIEW'])) + return redirect(url_for(current_app.config['LDAP_LOGIN_VIEW'], next=request.path)) return func(*args, **kwargs) return wrapped @@ -277,7 +275,7 @@ class LDAP(object): def wrapped(*args, **kwargs): if g.user is None: return redirect( - url_for(current_app.config['LDAP_LOGIN_VIEW'])) + url_for(current_app.config['LDAP_LOGIN_VIEW'], next=request.path)) match = [group for group in groups if group in g.ldap_groups] if not match: diff --git a/setup.py b/setup.py index 33c5b7257531612715777274eed66be6cf1c0670..29fd6aba5419c51d3528887daadb553fe464aedb 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ from setuptools import setup setup( name='Flask-SimpleLDAP', - version='0.2.0', + version='0.2.1', url='https://github.com/admiralobvious/flask-simpleldap', license='MIT', author='Alexandre Ferland',