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_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) ])
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') m = hashlib.sha256() m.update(salt) m.update(password) return m.hexdigest()