summaryrefslogtreecommitdiff
path: root/tools/mmd/MmdUser.py
diff options
context:
space:
mode:
authorJogi Hofmüller <jogi@mur.at>2011-07-31 16:38:40 +0000
committerJogi Hofmüller <jogi@mur.at>2011-07-31 16:38:40 +0000
commite6d1c7edf7be72017877fb9f5b77229afbea29f0 (patch)
tree2c4987953d432ee8f93dde617cc77fcd2ed8453a /tools/mmd/MmdUser.py
parent- new module MmdUser.py (diff)
- have a confirmation request sent by email for registration now
* still trouble with unicode/utf-8 characters entered in form ... git-svn-id: https://svn.spreadspace.org/mur.sat@86 7de4ea59-55d0-425e-a1af-a3118ea81d4c
Diffstat (limited to 'tools/mmd/MmdUser.py')
-rw-r--r--tools/mmd/MmdUser.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/tools/mmd/MmdUser.py b/tools/mmd/MmdUser.py
index 86e0a3d..ee45e72 100644
--- a/tools/mmd/MmdUser.py
+++ b/tools/mmd/MmdUser.py
@@ -2,6 +2,7 @@
User class for MURSAT1 Mission Dashboard
"""
import hashlib
+import smtplib
from cgi import parse_qs, escape
from MmdDb import Db
@@ -12,7 +13,20 @@ class User:
def create (self, user_id, firstname, lastname, email, callsign, longitude, latitude, password):
password_hash = hashlib.sha1 (password).hexdigest ()
- self.db.userCreate (user_id, firstname, lastname, email, callsign, password_hash)
+ token = str ('{0}{1}{2}{3}'.format (user_id, firstname, lastname, email))
+ confreg = hashlib.sha1 (token).hexdigest ()
+ self.db.userCreate (user_id, firstname, lastname, email, callsign, password_hash, confreg)
+ return confreg
+
+ def sendEmail (self, message):
+ server = smtplib.SMTP ('localhost')
+ try:
+ server.sendmail ('noreply@mur.at', self.email, message)
+ server.quit ()
+ return True
+ except (smtplib.SMTPRecipientsRefused, smtplib.SMTPHeloError, smtplib.SMTPSenderRefused, smtplib.SMTPDataError):
+ server.quit ()
+ return False
if __name__ == "__main__":
pass