Send email to the authenticated user's email address

This is better than hardcoding in my address.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2015-05-27 09:11:28 -04:00
parent bbe14fa88d
commit ea0eeeb46c
2 changed files with 9 additions and 0 deletions

View File

@ -11,6 +11,7 @@ os.chdir(os.path.dirname(path))
from . import api
from . import auth
from . import channels
from . import users
#
@ -25,7 +26,11 @@ __auth = auth.test()
if __auth == None:
sys.exit(1)
__TEAM = __auth["team"]
__USER = users.info(__auth["user_id"])
def team():
return __TEAM
def user():
return __USER

View File

@ -12,12 +12,16 @@ class User:
self.__user = json.get("name", "")
self.__first = json["profile"].get("first_name", "")
self.__last = json["profile"].get("last_name", "")
self.__email = json["profile"].get("email", "")
def name(self):
if self.__first == "" and self.__last == "":
return self.__user
return ("%s %s" % (self.__first, self.__last)).strip()
def email(self):
return self.__email
def info(user):