Skip to content

Commit

Permalink
Merge pull request #10 from eliasj/doc-flask-login-1
Browse files Browse the repository at this point in the history
Update ldap_app.py to work with flask-login >= 0.3
  • Loading branch information
nickw444 committed Mar 21, 2016
2 parents c8f0a30 + 14cadd2 commit ccc927b
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions ldap_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ def __repr__(self):
def get_id(self):
return self.dn

def is_anonymous(self):
return False


# Declare a User Loader for Flask-Login.
# Simply returns the User if it exists in our 'database', otherwise
Expand All @@ -71,7 +68,7 @@ def save_user(dn, username, data, memberships):
@app.route('/')
def home():
# Redirect users who are not logged in.
if not current_user or current_user.is_anonymous():
if not current_user or current_user.is_anonymous:
return redirect(url_for('login'))

# User is logged in, so show them a page with their cn and dn.
Expand Down Expand Up @@ -116,4 +113,4 @@ def login():
return render_template_string(template, form=form)

if __name__ == '__main__':
app.run()
app.run()

0 comments on commit ccc927b

Please sign in to comment.