Disable password change when SSO is the only login option

(imported from commit fd1a14237e2d6ea574331ed178bfc0db5beb18c6)
This commit is contained in:
Kevin Mehall
2013-11-04 17:42:31 -05:00
parent cc2d17d7c0
commit 4a6b7cb20b
7 changed files with 44 additions and 31 deletions

View File

@@ -1,11 +1,19 @@
from __future__ import absolute_import
from django.contrib.auth.backends import RemoteUserBackend
import django.contrib.auth
from zerver.models import UserProfile, get_user_profile_by_id, \
get_user_profile_by_email, remote_user_to_email
from openid.consumer.consumer import SUCCESS
def password_auth_enabled():
for backend in django.contrib.auth.get_backends():
if isinstance(backend, EmailAuthBackend):
return True
return False
class ZulipAuthMixin(object):
def get_user(self, user_profile_id):
""" Get a UserProfile object from the user_profile_id. """