Skip to content

Commit

Permalink
Changing is_authenticated from function to property & updating Flask-…
Browse files Browse the repository at this point in the history
…Login>=0.3.0
  • Loading branch information
ialex committed Sep 11, 2015
1 parent 4049c06 commit 7e85517
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions flask_security/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def _check_token():

user = _security.login_manager.token_callback(token)

if user and user.is_authenticated():
if user and user.is_authenticated:
app = current_app._get_current_object()
_request_ctx_stack.top.user = user
identity_changed.send(app, identity=Identity(user.id))
Expand Down Expand Up @@ -138,7 +138,7 @@ def dashboard():
login_mechanisms = {
'token': lambda: _check_token(),
'basic': lambda: _check_http_auth(),
'session': lambda: current_user.is_authenticated()
'session': lambda: current_user.is_authenticated
}

def wrapper(fn):
Expand Down Expand Up @@ -220,7 +220,7 @@ def decorated_view(*args, **kwargs):
def anonymous_user_required(f):
@wraps(f)
def wrapper(*args, **kwargs):
if current_user.is_authenticated():
if current_user.is_authenticated:
return redirect(utils.get_url(_security.post_login_view))
return f(*args, **kwargs)
return wrapper
2 changes: 1 addition & 1 deletion flask_security/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def login():
def logout():
"""View function which handles a logout request."""

if current_user.is_authenticated():
if current_user.is_authenticated:
logout_user()

return redirect(request.args.get('next', None) or
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Flask>=0.9
Flask-Login>=0.1.3
Flask-Login>=0.3.0
Flask-Mail>=0.7.3
Flask-Principal>=0.3.3
Flask-WTF>=0.8
Expand Down
4 changes: 2 additions & 2 deletions tests/templates/_nav.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{%- if current_user.is_authenticated() -%}
{%- if current_user.is_authenticated -%}
<p>Hello {{ current_user.email }}</p>
{%- endif %}
<ul>
Expand All @@ -11,7 +11,7 @@
<li><a href="{{ url_for('admin_or_editor') }}">Admin or Editor</a></li>
{% endif -%}
<li>
{%- if current_user.is_authenticated() -%}
{%- if current_user.is_authenticated -%}
<a href="{{ url_for('security.logout') }}">Log out</a>
{%- else -%}
<a href="{{ url_for('security.login') }}">Log in</a>
Expand Down

0 comments on commit 7e85517

Please sign in to comment.