summaryrefslogtreecommitdiff
path: root/baserock_openid_provider
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2014-11-07 17:47:01 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2014-11-07 17:48:44 +0000
commit4038d7abac16904ba655c5af96415571f3370660 (patch)
tree98092a05b053ca25649f523cb993a08eead08fb4 /baserock_openid_provider
parentc9c5861f4dff4e7f40486924606cf6907c846efc (diff)
downloadinfrastructure-4038d7abac16904ba655c5af96415571f3370660.tar.gz
openid_provider: Create an OpenID for each new user on registration
Diffstat (limited to 'baserock_openid_provider')
-rw-r--r--baserock_openid_provider/baserock_openid_provider/__init__.py17
-rw-r--r--baserock_openid_provider/baserock_openid_provider/signals.py29
2 files changed, 46 insertions, 0 deletions
diff --git a/baserock_openid_provider/baserock_openid_provider/__init__.py b/baserock_openid_provider/baserock_openid_provider/__init__.py
index e69de29b..8dd54d2a 100644
--- a/baserock_openid_provider/baserock_openid_provider/__init__.py
+++ b/baserock_openid_provider/baserock_openid_provider/__init__.py
@@ -0,0 +1,17 @@
+# Copyright (C) 2014 Codethink Limited
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+
+import signals
diff --git a/baserock_openid_provider/baserock_openid_provider/signals.py b/baserock_openid_provider/baserock_openid_provider/signals.py
new file mode 100644
index 00000000..53af7766
--- /dev/null
+++ b/baserock_openid_provider/baserock_openid_provider/signals.py
@@ -0,0 +1,29 @@
+# Copyright (C) 2014 Codethink Limited
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+
+from django.dispatch import receiver
+import registration.signals
+
+import logging
+
+
+# This should watch 'registration.signals.user_activated' instead, if we ever
+# decide to enable activation emails (i.e. if we switch from the 'simple'
+# backend to the 'default' backend).
+@receiver(registration.signals.user_registered)
+def user_creation_handler(sender, user, request, **kwargs):
+ logging.info('Creating OpenID for user %s' % (user.username))
+ user.openid_set.create(openid=user.username)