Commits

Steven Kryskalla committed 069029c

fixing occasional KeyError for 'ldapusername'

Comments (0)

Files changed (1)

solace/_ldap_auth.py

             return self.first_login(request)
 
     def complete_login(self, request):
-        user = User.query.filter_by(username=request.session['ldapusername']).first()
+        username = request.session.get('ldapusername', '')
+        user = User.query.filter_by(username=username).first()
         if not user:
             request.session['ldapusername'] = ''
             return redirect(url_for('core.login', firstlogin='yes', next=request.next_url))