def send_forgot_password_email(self): subject = utils.render_template_raw('email/forgot_password/subject', {'account': self}, type='txt').strip() body = utils.render_template_raw('email/forgot_password/body', { 'account' : self, 'url_prefix' : settings.SITE_URL_PREFIX, 'email_support_name' : settings.EMAIL_SUPPORT_NAME, 'email_support_address' : settings.EMAIL_SUPPORT_ADDRESS}, type='txt') utils.send_mail(subject, body, "%s <%s>" % (settings.EMAIL_SUPPORT_NAME, settings.EMAIL_SUPPORT_ADDRESS), ["%s <%s>" % (self.full_name or self.contact_email, self.contact_email)])
def send_welcome_email(self): subject = utils.render_template_raw('email/welcome/subject', {'account': self}, type='txt').strip() body = utils.render_template_raw('email/welcome/body', { 'account': self, 'full_name': self.full_name or self.contact_email, 'url_prefix': settings.UI_SERVER_URL, 'email_support_name': settings.EMAIL_SUPPORT_NAME, 'email_support_address': settings.EMAIL_SUPPORT_ADDRESS }, type='txt') utils.send_mail(subject, body, "%s <%s>" % (settings.EMAIL_SUPPORT_NAME, settings.EMAIL_SUPPORT_ADDRESS), ["%s <%s>" % (self.full_name or self.contact_email, self.contact_email)])
def notify_account_of_new_message(self): subject = utils.render_template_raw('email/new_message/subject', {'account': self}, type='txt').strip() body = utils.render_template_raw('email/new_message/body', {'account': self, 'full_name': self.full_name or self.contact_email, 'url_prefix': settings.SITE_URL_PREFIX, 'email_support_name': settings.EMAIL_SUPPORT_NAME, 'email_support_address': settings.EMAIL_SUPPORT_ADDRESS }, type='txt') utils.send_mail(subject, body, "%s <%s>" % (settings.EMAIL_SUPPORT_NAME, settings.EMAIL_SUPPORT_ADDRESS), ["%s <%s>" % (self.full_name or self.contact_email, self.contact_email)])
def send_secret(self): # mail template subject = utils.render_template_raw('indivo/email/secret/subject', {'account' : self}, type='txt').strip() body = utils.render_template_raw('indivo/email/secret/body', { 'account' : self, 'url_prefix' : settings.SITE_URL_PREFIX, 'email_support_name' : settings.EMAIL_SUPPORT_NAME, 'email_support_address' : settings.EMAIL_SUPPORT_ADDRESS, 'full_name' : self.full_name or self.contact_email }, type='txt') utils.send_mail(subject, body, "%s <%s>" % (settings.EMAIL_SUPPORT_NAME, settings.EMAIL_SUPPORT_ADDRESS), ["%s <%s>" % (self.full_name or self.contact_email, self.contact_email)])
def notify_account_of_new_message(self): # only notify accounts that have a state of active or disabled if self.state == ACTIVE or self.state == DISABLED: subject = utils.render_template_raw('email/new_message/subject', {'account': self}, type='txt').strip() body = utils.render_template_raw('email/new_message/body', {'account': self, 'full_name': self.full_name or self.contact_email, 'url_prefix': settings.UI_SERVER_URL, 'email_support_name': settings.EMAIL_SUPPORT_NAME, 'email_support_address': settings.EMAIL_SUPPORT_ADDRESS }, type='txt') utils.send_mail(subject, body, "%s <%s>" % (settings.EMAIL_SUPPORT_NAME, settings.EMAIL_SUPPORT_ADDRESS), ["%s <%s>" % (self.full_name or self.contact_email, self.contact_email)])
def send_forgot_password_email(self): subject = utils.render_template_raw('email/forgot_password/subject', {'account': self}, type='txt').strip() account_id = self.id username = '' try: conn = psycopg2.connect("dbname='indivo' user='******' host='localhost' password='******'"); # conn.autocommit = True conn.set_isolation_level(0) conn.commit() cursor = conn.cursor() except psycopg2.DatabaseError, e: return HttpResponse(e)
def send_secret(self): # mail template subject = utils.render_template_raw('indivo/email/secret/subject', { 'account': self }, type='txt').strip() body = utils.render_template_raw( 'indivo/email/secret/body', { 'account': self, 'url_prefix': settings.SITE_URL_PREFIX, 'email_support_name': settings.EMAIL_SUPPORT_NAME, 'email_support_address': settings.EMAIL_SUPPORT_ADDRESS, 'full_name': self.full_name or self.contact_email }, type='txt') utils.send_mail( subject, body, "%s <%s>" % (settings.EMAIL_SUPPORT_NAME, settings.EMAIL_SUPPORT_ADDRESS), [ "%s <%s>" % (self.full_name or self.contact_email, self.contact_email) ])
def notify_account_of_new_message(self): # only notify accounts that have a state of active or disabled if self.state == ACTIVE or self.state == DISABLED: subject = utils.render_template_raw('email/new_message/subject', { 'account': self }, type='txt').strip() body = utils.render_template_raw( 'email/new_message/body', { 'account': self, 'full_name': self.full_name or self.contact_email, 'url_prefix': settings.UI_SERVER_URL, 'email_support_name': settings.EMAIL_SUPPORT_NAME, 'email_support_address': settings.EMAIL_SUPPORT_ADDRESS }, type='txt') utils.send_mail( subject, body, "%s <%s>" % (settings.EMAIL_SUPPORT_NAME, settings.EMAIL_SUPPORT_ADDRESS), [ "%s <%s>" % (self.full_name or self.contact_email, self.contact_email) ])
def as_xml(self): """XML string representation of Demographics instance""" return utils.render_template_raw("demographics", {'demographics': self})
except psycopg2.DatabaseError, e: return HttpResponse(e) try: cursor.execute( "SELECT username FROM public.indivo_accountauthsystem where account_id='"+account_id+"'" ) conn.commit() username = cursor.fetchall() except psycopg2.DatabaseError, e: return HttpResponse(e) body = utils.render_template_raw('email/forgot_password/body', {'account': self, 'username':str(username[0][0]), 'url_prefix': settings.UI_SERVER_URL, 'email_support_name': settings.EMAIL_SUPPORT_NAME, 'email_support_address': settings.EMAIL_SUPPORT_ADDRESS}, type='txt') utils.send_mail(subject, body, "%s <%s>" % (settings.EMAIL_SUPPORT_NAME, settings.EMAIL_SUPPORT_ADDRESS), ["%s <%s>" % (self.full_name or self.contact_email, self.contact_email)]) @classmethod def compute_hash(cls, password, salt): if not (isinstance(password, str) and isinstance(salt, str)): try: salt = str(salt) password = str(password) except: raise Exception('Password and Salt need to be strings')