aboutsummaryrefslogtreecommitdiff
path: root/app/dispatchAuth/models.py
diff options
context:
space:
mode:
authorMitch Riedstra <mitch@riedstra.us>2017-11-10 20:44:21 -0500
committerMitch Riedstra <mitch@riedstra.us>2017-11-10 20:44:21 -0500
commit6155857dcd9a88d07756c465df42c5155c7183dc (patch)
treee0f59809d0b52410188b42d9b6be74abe17d8ce5 /app/dispatchAuth/models.py
parent69d5a098f830128414f178d9382c65221f06e4bb (diff)
downloaddispatch-tracker-6155857dcd9a88d07756c465df42c5155c7183dc.tar.gz
dispatch-tracker-6155857dcd9a88d07756c465df42c5155c7183dc.tar.xz
User registration works. User invites work but has no UI
Diffstat (limited to 'app/dispatchAuth/models.py')
-rw-r--r--app/dispatchAuth/models.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/dispatchAuth/models.py b/app/dispatchAuth/models.py
index 3132f1d..8173146 100644
--- a/app/dispatchAuth/models.py
+++ b/app/dispatchAuth/models.py
@@ -1,4 +1,6 @@
from django.contrib.auth.models import AbstractUser, AbstractBaseUser, PermissionsMixin, BaseUserManager
+from app.settings import WEBSITE_URI
+from django.template.loader import render_to_string
from django.core.mail import send_mail
from django.core.urlresolvers import reverse
from django.db import models
@@ -71,6 +73,17 @@ class User(PermissionsMixin, AbstractBaseUser):
"""Send an email to this user."""
send_mail(subject, message, from_email, [self.email], **kwargs)
+ def send_invite(self, name, to, from_email=None, **kwargs):
+ """Send an invite for a new user to register"""
+ current_site = WEBSITE_URI
+ message = render_to_string('dispatch/invite_email.txt',
+ { 'name': name, 'user': self, 'site': current_site })
+
+ send_mail("Invitation to register at {}".format(current_site),
+ message,
+ from_email,
+ [to])
+
@property
def is_staff(self):