def send_reset_password_email(self, email, reset_code):
     sent_email = None
     request = self._database.request_forgot_password(email, reset_code)
     
     if request:
         text="""\
         Hi {1},            
         Your reset password code is {0}.
         Follow this link to reset your password: {2}/resetpassword?email={1}&resetcode={0}
         """
         text = text.format(reset_code, email, CF_WEBSERVICE_URL)
         html="""\
         <html>
         <head></head>
         <body>
         Hi <b>{1}</b>,            
         Your reset password code is {0}.<br/>
         Follow this link to reset your password: <a href={2}/resetpassword?email={1}&resetcode={0}>Reset password</a>
         </body>
         </html>
         """
         html = html.format(reset_code, email, CF_WEBSERVICE_URL)
         msg = multipart_email(CF_EMAIL_NOREPLY, email, 'Reset password', text, html)
         if self.email_manager:
             sent_email = self.email_manager.enqueue(msg)
     return sent_email
Example #2
0
 def send_verification_email(self,username, email, verification_code):
     #msg = MIMEText('Registration is sucessful. Your verification code is {}.'.format(verification_code))
     sent_email = False
     verified = self._auth_db.create_email_verification_code(verification_code, username)
     if verified:        
         text="""\
         Registration for user {0} is successful.
         Your verification code is {1}.
         Follow this link to complete your email verification: http://{2}/service/verifyemail?verification_code={1}&username={0}
         """
         text = text.format(username, verification_code, HOST_DOMAIN_NAME)
         html="""\
         <html>
         <head></head>
         <body>
         Registration for user <b>{0}</b> is successful.<br/>
         Your verification code is <b><i>{1}</i></b>.<br/>
         Follow this link to complete your email verification: <a href=http://{2}/service/verifyemail?verification_code={1}&username={0}>Verify Email</a>
         </body>
         </html>
         """
         html = html.format(username, verification_code, HOST_DOMAIN_NAME)
         msg = multipart_email('*****@*****.**', email, 'Cacafefe registration', text, html)
         sent_email = push_email_to_sending_queue(msg)            
     return sent_email
 def send_verification_email(self,username, email, verification_code):
     sent_email = False
     verified = self._auth_db.create_email_verification_code(verification_code, username)
     if verified:            
         text="""\
         Hi {1},            
         Your verification code is {0}.
         Follow this link to complete your email verification: {2}/verifyemail?verification_code={0}&username={1}
         """
         text = text.format(verification_code,username, CF_WEBSERVICE_URL)
         html="""\
         <html>
         <head></head>
         <body>  
         Hi <b>{1}</b>,         
         Your verification code is {0}.<br/>
         Follow this link to complete your email verification: <a href={2}/verifyemail?verification_code={0}&username={1}>Verify Email</a>
         </body>
         </html> 
         """
         html = html.format(verification_code, username, CF_WEBSERVICE_URL)
         msg = multipart_email(CF_EMAIL_NOREPLY, email, 'Email verification', text, html)
         sent_email = push_email_to_sending_queue(msg)            
     return sent_email