backends: PEP8ness, style (#30252)

This commit is contained in:
Benjamin Dauvergne 2019-02-14 11:26:14 +01:00
parent f29496c5f1
commit 34f42d271a
1 changed files with 19 additions and 2 deletions

View File

@ -1,8 +1,25 @@
#
# Copyright (C) 2010-2019 Entr'ouvert
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
from django.db import models
from django.contrib.auth import get_user_model
from django.contrib.auth.backends import ModelBackend
from django.utils import six
from .. import app_settings
from authentic2.user_login_failure import user_login_success, user_login_failure
@ -39,10 +56,10 @@ class ModelBackend(ModelBackend):
if app_settings.REALMS:
for realm, desc in app_settings.REALMS:
queries.append(models.Q(
**{username_field: upn(username, realm)}))
**{username_field: upn(username, realm)}))
else:
queries.append(models.Q(**{username_field: upn(username, realm)}))
return reduce(models.Q.__or__, queries)
return six.moves.reduce(models.Q.__or__, queries)
def must_reset_password(self, user):
from .. import models