Merge pull request #324 from pcoder/feature/3296/confirm_emails
Feature/3296/confirm emails
This commit is contained in:
		
				commit
				
					
						5271591cf3
					
				
			
		
					 8 changed files with 348 additions and 14 deletions
				
			
		|  | @ -0,0 +1,129 @@ | |||
| {% load static from staticfiles %} | ||||
| <!-- Inliner Build Version 4380b7741bb759d6cb997545f3add21ad48f010b --> | ||||
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> | ||||
| <html xmlns="http://www.w3.org/1999/xhtml" style="font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"> | ||||
| <head> | ||||
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | ||||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | ||||
| <title>Oxygen Invoice</title> | ||||
| </head> | ||||
| <body bgcolor="#ffffff" style="font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; width: 100% !important; height: 100%; color: white; margin: 0;"> | ||||
| <style type="text/css"> | ||||
| @media only screen and (max-width: 480px) { | ||||
|   table[class*="container-for-gmail-android"] { | ||||
|     min-width: 290px !important; width: 100% !important; | ||||
|   } | ||||
|   img[class="force-width-gmail"] { | ||||
|     display: none !important; width: 0 !important; height: 0 !important; | ||||
|   } | ||||
|   table[class="w320"] { | ||||
|     width: 320px !important; | ||||
|   } | ||||
|   td[class*="mobile-header-padding-left"] { | ||||
|     width: 160px !important; padding-left: 0 !important; | ||||
|   } | ||||
|   td[class*="mobile-header-padding-right"] { | ||||
|     width: 160px !important; padding-right: 0 !important; | ||||
|   } | ||||
|   td[class="header-lg"] { | ||||
|     font-size: 24px !important; padding-bottom: 5px !important; | ||||
|   } | ||||
|   td[class="content-padding"] { | ||||
|     padding: 5px 0 5px !important; | ||||
|   } | ||||
|   td[class="button"] { | ||||
|     padding: 5px 5px 30px !important; | ||||
|   } | ||||
|   td[class*="free-text"] { | ||||
|     padding: 10px 18px 30px !important; | ||||
|   } | ||||
|   td[class~="mobile-hide-img"] { | ||||
|     display: none !important; height: 0 !important; width: 0 !important; line-height: 0 !important; | ||||
|   } | ||||
|   td[class~="item"] { | ||||
|     width: 140px !important; vertical-align: top !important; | ||||
|   } | ||||
|   td[class~="quantity"] { | ||||
|     width: 50px !important; | ||||
|   } | ||||
|   td[class~="price"] { | ||||
|     width: 90px !important; | ||||
|   } | ||||
|   td[class="item-table"] { | ||||
|     padding: 30px 20px !important; | ||||
|   } | ||||
|   td[class="mini-container-left"] { | ||||
|     padding: 0 15px 15px !important; display: block !important; width: 290px !important; | ||||
|   } | ||||
|   td[class="mini-container-right"] { | ||||
|     padding: 0 15px 15px !important; display: block !important; width: 290px !important; | ||||
|   } | ||||
| } | ||||
| </style> | ||||
| <table align="center" cellpadding="0" cellspacing="0" class="container-for-gmail-android" width="100%" style="border-collapse: collapse !important; min-width: 600px; font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"> | ||||
| <tr style="font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"> | ||||
| <td align="left" valign="top" width="100%" style="border-collapse: collapse; font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important; font-size: 14px; color: #777777; text-align: center; line-height: 21px; background: #ffffff url(http://s3.amazonaws.com/swu-filepicker/4E687TRe69Ld95IDWyEg_bg_top_02.jpg) repeat-x;" bgcolor="#ffffff"> | ||||
|       <center style="font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"> | ||||
|       <table cellspacing="0" cellpadding="0" width="100%" bgcolor="#ffffff" background="http://s3.amazonaws.com/swu-filepicker/4E687TRe69Ld95IDWyEg_bg_top_02.jpg" style="border-collapse: collapse !important; font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important; background: transparent;"><tr style="font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"> | ||||
| <td width="100%" height="80" valign="top" style="text-align: center; vertical-align: middle; border-collapse: collapse; font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important; font-size: 14px; color: #777777; line-height: 21px; background-color: #ffffff" align="center"> | ||||
|             <!--[if gte mso 9]> | ||||
|             <v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="true" stroke="false" style="mso-width-percent:1000;height:80px; v-text-anchor:middle;"> | ||||
|               <v:fill type="tile" src="http://s3.amazonaws.com/swu-filepicker/4E687TRe69Ld95IDWyEg_bg_top_02.jpg" color="#ffffff" /> | ||||
|               <v:textbox inset="0,0,0,0"> | ||||
|             <![endif]--> | ||||
|               <center style="font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"> | ||||
|                 <table cellpadding="0" cellspacing="0" width="600" class="w320" style="border-collapse: collapse !important; font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"><tr style="font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"> | ||||
| <td class="pull-left mobile-header-padding-left" style="vertical-align: middle; border-collapse: collapse; font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important; font-size: 14px; color: #777777; text-align: left; line-height: 21px; width: 290px; padding-left: 10px;" align="left" valign="middle"> | ||||
|                       <a href="{{base_url}}" style="font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important; color: #676767; text-decoration: none !important;"><img width="137" src="{{base_url}}{% static 'datacenterlight/img/datacenterlight.png' %}" alt="logo" style="max-width: 600px; outline: none; text-decoration: none; -ms-interpolation-mode: bicubic; font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important; border: none;"></a> | ||||
|                     </td> | ||||
|                     <td class="pull-right mobile-header-padding-right" style="color: #4d4d4d; border-collapse: collapse; font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important; font-size: 14px; text-align: right; line-height: 21px; width: 290px; padding-left: 10px;" align="right"> | ||||
|                     </td> | ||||
|                   </tr></table> | ||||
| </center> | ||||
|               <!--[if gte mso 9]> | ||||
|               </v:textbox> | ||||
|             </v:rect> | ||||
|             <![endif]--> | ||||
|             </td> | ||||
|           </tr></table> | ||||
| </center> | ||||
|     </td> | ||||
|   </tr> | ||||
| <tr style="font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"> | ||||
| <td align="center" valign="top" width="100%" style="border-collapse: collapse; font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important; font-size: 14px; color: #777777; text-align: center; line-height: 21px; background: #ffffff; padding: 20px 0 5px;" class="content-padding" bgcolor="#f7f7f7"> | ||||
|       <center style="font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"> | ||||
|         <table cellspacing="0" cellpadding="0" width="600" class="w320" style="border-collapse: collapse !important; font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"> | ||||
| <tr style="font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"> | ||||
| <td class="header-lg" style="border-collapse: collapse; font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important; font-size: 32px; color: #4d4d4d; text-align: left; line-height: normal; font-weight: 400; padding: 35px 5 0;" align="center"> | ||||
|               Datacenterlight user activation | ||||
|             </td> | ||||
|           </tr> | ||||
| <tr style="font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"> | ||||
| <td class="free-text" style="border-collapse: collapse; font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important; font-size: 14px; color: #777777; text-align: left; line-height: 21px; width: 100% !important; padding: 40px 7px 20px;" align="center"> | ||||
|              <p> | ||||
|                 You can activate your datacenterlight account by <a href="{{base_url}}{{activation_link}}">clicking here</a>.</br></br> | ||||
|                 You can also copy and paste the following link into the address bar of your browser and follow the link in order to activate your datacenterlight account.</br> | ||||
|                 {{base_url}}{{activation_link}}              | ||||
|              </p></td> | ||||
|           </tr> | ||||
| <tr style="font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"> | ||||
| <td class="button" style="border-collapse: collapse; font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important; font-size: 14px; color: #777777; text-align: center; line-height: 21px; padding: 0;" align="center"> </td> | ||||
|           </tr> | ||||
| </table> | ||||
| </center> | ||||
|     </td> | ||||
|   </tr> | ||||
| <tr style="font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"> | ||||
| <td align="center" valign="top" width="100%" style="height: 100px; border-collapse: collapse; font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important; font-size: 14px; color: #777777; text-align: center; line-height: 21px; background: #ffffff;" bgcolor="#ffffff"> | ||||
|       <center style="font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"> | ||||
|         <table cellspacing="0" cellpadding="0" width="600" class="w320" style="border-collapse: collapse !important; font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"><tr style="font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"> | ||||
| <td style="border-collapse: collapse; font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important; font-size: 14px; font-weight: 600; color: #7293de; padding: 25px 9px 0px;text-align: left; line-height: 21px;;" align="left">Your data center light team<br style="font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"> | ||||
| </td> | ||||
|           </tr></table> | ||||
| </center> | ||||
|     </td> | ||||
|   </tr> | ||||
| </table> | ||||
| </body> | ||||
| </html> | ||||
| 
 | ||||
|  | @ -0,0 +1,129 @@ | |||
| {% load static from staticfiles %} | ||||
| <!-- Inliner Build Version 4380b7741bb759d6cb997545f3add21ad48f010b --> | ||||
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> | ||||
| <html xmlns="http://www.w3.org/1999/xhtml" style="font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"> | ||||
| <head> | ||||
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | ||||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | ||||
| <title>Oxygen Invoice</title> | ||||
| </head> | ||||
| <body bgcolor="#ffffff" style="font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; width: 100% !important; height: 100%; color: white; margin: 0;"> | ||||
| <style type="text/css"> | ||||
| @media only screen and (max-width: 480px) { | ||||
|   table[class*="container-for-gmail-android"] { | ||||
|     min-width: 290px !important; width: 100% !important; | ||||
|   } | ||||
|   img[class="force-width-gmail"] { | ||||
|     display: none !important; width: 0 !important; height: 0 !important; | ||||
|   } | ||||
|   table[class="w320"] { | ||||
|     width: 320px !important; | ||||
|   } | ||||
|   td[class*="mobile-header-padding-left"] { | ||||
|     width: 160px !important; padding-left: 0 !important; | ||||
|   } | ||||
|   td[class*="mobile-header-padding-right"] { | ||||
|     width: 160px !important; padding-right: 0 !important; | ||||
|   } | ||||
|   td[class="header-lg"] { | ||||
|     font-size: 24px !important; padding-bottom: 5px !important; | ||||
|   } | ||||
|   td[class="content-padding"] { | ||||
|     padding: 5px 0 5px !important; | ||||
|   } | ||||
|   td[class="button"] { | ||||
|     padding: 5px 5px 30px !important; | ||||
|   } | ||||
|   td[class*="free-text"] { | ||||
|     padding: 10px 18px 30px !important; | ||||
|   } | ||||
|   td[class~="mobile-hide-img"] { | ||||
|     display: none !important; height: 0 !important; width: 0 !important; line-height: 0 !important; | ||||
|   } | ||||
|   td[class~="item"] { | ||||
|     width: 140px !important; vertical-align: top !important; | ||||
|   } | ||||
|   td[class~="quantity"] { | ||||
|     width: 50px !important; | ||||
|   } | ||||
|   td[class~="price"] { | ||||
|     width: 90px !important; | ||||
|   } | ||||
|   td[class="item-table"] { | ||||
|     padding: 30px 20px !important; | ||||
|   } | ||||
|   td[class="mini-container-left"] { | ||||
|     padding: 0 15px 15px !important; display: block !important; width: 290px !important; | ||||
|   } | ||||
|   td[class="mini-container-right"] { | ||||
|     padding: 0 15px 15px !important; display: block !important; width: 290px !important; | ||||
|   } | ||||
| } | ||||
| </style> | ||||
| <table align="center" cellpadding="0" cellspacing="0" class="container-for-gmail-android" width="100%" style="border-collapse: collapse !important; min-width: 600px; font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"> | ||||
| <tr style="font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"> | ||||
| <td align="left" valign="top" width="100%" style="border-collapse: collapse; font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important; font-size: 14px; color: #777777; text-align: center; line-height: 21px; background: #ffffff url(http://s3.amazonaws.com/swu-filepicker/4E687TRe69Ld95IDWyEg_bg_top_02.jpg) repeat-x;" bgcolor="#ffffff"> | ||||
|       <center style="font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"> | ||||
|       <table cellspacing="0" cellpadding="0" width="100%" bgcolor="#ffffff" background="http://s3.amazonaws.com/swu-filepicker/4E687TRe69Ld95IDWyEg_bg_top_02.jpg" style="border-collapse: collapse !important; font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important; background: transparent;"><tr style="font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"> | ||||
| <td width="100%" height="80" valign="top" style="text-align: center; vertical-align: middle; border-collapse: collapse; font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important; font-size: 14px; color: #777777; line-height: 21px; background-color: #ffffff" align="center"> | ||||
|             <!--[if gte mso 9]> | ||||
|             <v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="true" stroke="false" style="mso-width-percent:1000;height:80px; v-text-anchor:middle;"> | ||||
|               <v:fill type="tile" src="http://s3.amazonaws.com/swu-filepicker/4E687TRe69Ld95IDWyEg_bg_top_02.jpg" color="#ffffff" /> | ||||
|               <v:textbox inset="0,0,0,0"> | ||||
|             <![endif]--> | ||||
|               <center style="font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"> | ||||
|                 <table cellpadding="0" cellspacing="0" width="600" class="w320" style="border-collapse: collapse !important; font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"><tr style="font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"> | ||||
| <td class="pull-left mobile-header-padding-left" style="vertical-align: middle; border-collapse: collapse; font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important; font-size: 14px; color: #777777; text-align: left; line-height: 21px; width: 290px; padding-left: 10px;" align="left" valign="middle"> | ||||
|                       <a href="{{base_url}}" style="font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important; color: #676767; text-decoration: none !important;"><img width="137" src="{{base_url}}{% static 'datacenterlight/img/datacenterlight.png' %}" alt="logo" style="max-width: 600px; outline: none; text-decoration: none; -ms-interpolation-mode: bicubic; font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important; border: none;"></a> | ||||
|                     </td> | ||||
|                     <td class="pull-right mobile-header-padding-right" style="color: #4d4d4d; border-collapse: collapse; font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important; font-size: 14px; text-align: right; line-height: 21px; width: 290px; padding-left: 10px;" align="right"> | ||||
|                     </td> | ||||
|                   </tr></table> | ||||
| </center> | ||||
|               <!--[if gte mso 9]> | ||||
|               </v:textbox> | ||||
|             </v:rect> | ||||
|             <![endif]--> | ||||
|             </td> | ||||
|           </tr></table> | ||||
| </center> | ||||
|     </td> | ||||
|   </tr> | ||||
| <tr style="font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"> | ||||
| <td align="center" valign="top" width="100%" style="border-collapse: collapse; font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important; font-size: 14px; color: #777777; text-align: center; line-height: 21px; background: #ffffff; padding: 20px 0 5px;" class="content-padding" bgcolor="#f7f7f7"> | ||||
|       <center style="font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"> | ||||
|         <table cellspacing="0" cellpadding="0" width="600" class="w320" style="border-collapse: collapse !important; font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"> | ||||
| <tr style="font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"> | ||||
| <td class="header-lg" style="border-collapse: collapse; font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important; font-size: 32px; color: #4d4d4d; text-align: left; line-height: normal; font-weight: 400; padding: 35px 5 0;" align="center"> | ||||
|               Datacenterlight user activation | ||||
|             </td> | ||||
|           </tr> | ||||
| <tr style="font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"> | ||||
| <td class="free-text" style="border-collapse: collapse; font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important; font-size: 14px; color: #777777; text-align: left; line-height: 21px; width: 100% !important; padding: 40px 7px 20px;" align="center"> | ||||
|              <p> | ||||
|                 You can activate your datacenterlight account by <a href="{{base_url}}{{activation_link}}">clicking here</a>.</br></br> | ||||
|                 You can also copy and paste the following link into the address bar of your browser and follow the link in order to activate your datacenterlight account.</br> | ||||
|                 {{base_url}}{{activation_link}}              | ||||
|              </p></td> | ||||
|           </tr> | ||||
| <tr style="font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"> | ||||
| <td class="button" style="border-collapse: collapse; font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important; font-size: 14px; color: #777777; text-align: center; line-height: 21px; padding: 0;" align="center"> </td> | ||||
|           </tr> | ||||
| </table> | ||||
| </center> | ||||
|     </td> | ||||
|   </tr> | ||||
| <tr style="font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"> | ||||
| <td align="center" valign="top" width="100%" style="height: 100px; border-collapse: collapse; font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important; font-size: 14px; color: #777777; text-align: center; line-height: 21px; background: #ffffff;" bgcolor="#ffffff"> | ||||
|       <center style="font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"> | ||||
|         <table cellspacing="0" cellpadding="0" width="600" class="w320" style="border-collapse: collapse !important; font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"><tr style="font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"> | ||||
| <td style="border-collapse: collapse; font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important; font-size: 14px; font-weight: 600; color: #7293de; padding: 25px 9px 0px;text-align: left; line-height: 21px;;" align="left">Your data center light team<br style="font-family: 'Raleway', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"> | ||||
| </td> | ||||
|           </tr></table> | ||||
| </center> | ||||
|     </td> | ||||
|   </tr> | ||||
| </table> | ||||
| </body> | ||||
| </html> | ||||
| 
 | ||||
|  | @ -24,6 +24,8 @@ class HostingUserLoginForm(forms.Form): | |||
|         is_auth = authenticate(email=email, password=password) | ||||
|         if not is_auth: | ||||
|             raise forms.ValidationError("Your username and/or password were incorrect.") | ||||
|         elif is_auth.validated == 0: | ||||
|             raise forms.ValidationError(_("Your account is not activated yet.")) | ||||
|         return self.cleaned_data | ||||
| 
 | ||||
|     def clean_email(self): | ||||
|  |  | |||
|  | @ -318,6 +318,17 @@ h6 { | |||
|     padding: 15px 20px 0 20px; | ||||
| } | ||||
| 
 | ||||
| .sign-up-message { | ||||
|     padding: 25px 30px 25px 30px; | ||||
|     text-align: justify; | ||||
|     font-size: 18px; | ||||
|     line-height: 30px; | ||||
| } | ||||
| .sign-up-message a { | ||||
|     font-size: 18px; | ||||
|     color: #1e94cc !important; | ||||
| } | ||||
| 
 | ||||
| @media (max-width: 1199px) { | ||||
|     ul.banner-social-buttons { | ||||
|         float: left; | ||||
|  |  | |||
							
								
								
									
										21
									
								
								hosting/templates/hosting/signup_validate.html
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								hosting/templates/hosting/signup_validate.html
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,21 @@ | |||
| {% extends "hosting/base_short.html" %} | ||||
| {% load staticfiles bootstrap3 i18n %} | ||||
| 
 | ||||
| {% block content %} | ||||
| <div class="auth-container"> | ||||
|    <div class="auth-bg"></div> | ||||
|     <div class="container"> | ||||
|             <div class="auth-title"> | ||||
|                 <h2>{% trans "Your VM hosted in Switzerland"%}</h2> | ||||
|             </div> | ||||
|             <div class="auth-content"> | ||||
|                 <div class="intro-message auth-box sign-up"> | ||||
|                     <h2  class="section-heading">{{section_title}}</h2> | ||||
|                     <div class="sign-up-message"> | ||||
|                          {{message}} | ||||
|                     </div> | ||||
|                 </div> | ||||
|         </div> | ||||
|     </div> | ||||
| </div> | ||||
| {% endblock %} | ||||
|  | @ -1,7 +1,7 @@ | |||
| from django.conf.urls import url | ||||
| 
 | ||||
| from .views import DjangoHostingView, RailsHostingView, PaymentVMView,\ | ||||
|     NodeJSHostingView, LoginView, SignupView, IndexView, \ | ||||
|     NodeJSHostingView, LoginView, SignupView, SignupValidateView, SignupValidatedView, IndexView, \ | ||||
|     OrdersHostingListView, OrdersHostingDetailView, VirtualMachinesPlanListView,\ | ||||
|     VirtualMachineView, OrdersHostingDeleteView, NotificationsView, \ | ||||
|     MarkAsReadNotificationView, PasswordResetView, PasswordResetConfirmView, HostingPricingView,\ | ||||
|  | @ -35,9 +35,11 @@ urlpatterns = [ | |||
|         name='read_notification'), | ||||
|     url(r'login/?$', LoginView.as_view(), name='login'), | ||||
|     url(r'signup/?$', SignupView.as_view(), name='signup'), | ||||
|     url(r'signup-validate/?$', SignupValidateView.as_view(), name='signup-validate'), | ||||
|     url(r'reset-password/?$', PasswordResetView.as_view(), name='reset_password'), | ||||
|     url(r'reset-password-confirm/(?P<uidb64>[0-9A-Za-z]+)-(?P<token>.+)/$', | ||||
|         PasswordResetConfirmView.as_view(), name='reset_password_confirm'), | ||||
|     url(r'^logout/?$', 'django.contrib.auth.views.logout', | ||||
|         {'next_page': '/hosting/login?logged_out=true'}, name='logout') | ||||
|         {'next_page': '/hosting/login?logged_out=true'}, name='logout'), | ||||
|     url(r'^validate/(?P<validate_slug>.*)/$', SignupValidatedView.as_view(), name='validate') | ||||
| ] | ||||
|  |  | |||
|  | @ -18,7 +18,7 @@ from guardian.mixins import PermissionRequiredMixin | |||
| from stored_messages.settings import stored_messages_settings | ||||
| from stored_messages.models import Message | ||||
| from stored_messages.api import mark_read | ||||
| 
 | ||||
| from django.utils.safestring import mark_safe | ||||
| 
 | ||||
| from membership.models import CustomUser, StripeCustomer | ||||
| from utils.stripe_utils import StripeUtils | ||||
|  | @ -32,6 +32,7 @@ from .mixins import ProcessVMSelectionMixin | |||
| from opennebula_api.models import OpenNebulaManager | ||||
| from opennebula_api.serializers import VirtualMachineSerializer,\ | ||||
|     VirtualMachineTemplateSerializer | ||||
| from django.utils.translation import ugettext_lazy as _ | ||||
| 
 | ||||
| 
 | ||||
| from oca.exceptions import OpenNebulaException | ||||
|  | @ -199,12 +200,39 @@ class SignupView(CreateView): | |||
|         name = form.cleaned_data.get('name') | ||||
|         email = form.cleaned_data.get('email') | ||||
|         password = form.cleaned_data.get('password') | ||||
|         this_base_url = "{0}://{1}".format(self.request.scheme, self.request.get_host()) | ||||
|         CustomUser.register(name, password, email, app='dcl', base_url=this_base_url) | ||||
| 
 | ||||
|         CustomUser.register(name, password, email) | ||||
|         auth_user = authenticate(email=email, password=password) | ||||
|         login(self.request, auth_user) | ||||
|         return HttpResponseRedirect(reverse_lazy('hosting:signup-validate')) | ||||
| 
 | ||||
|         return HttpResponseRedirect(self.get_success_url()) | ||||
| class SignupValidateView(TemplateView): | ||||
|     template_name = "hosting/signup_validate.html" | ||||
|      | ||||
|     def get_context_data(self, **kwargs): | ||||
|         context = super(SignupValidateView, self).get_context_data(**kwargs) | ||||
|         login_url = reverse('hosting:login') | ||||
|         message= _("Thank you for signing up. We have sent an email to you. Please follow the instructions in it to activate your account. Once activated, you can login using ") + '<a href="' + login_url +'">login</a>' | ||||
|         section_title='Sign up' | ||||
|         context['message'] = mark_safe(message) | ||||
|         context['section_title'] = section_title | ||||
|         return context | ||||
| 
 | ||||
| class SignupValidatedView(SignupValidateView): | ||||
|     template_name = "hosting/signup_validate.html" | ||||
|      | ||||
|     def get_context_data(self, **kwargs): | ||||
|         context = super(SignupValidateView, self).get_context_data(**kwargs) | ||||
|         validated = CustomUser.validate_url(self.kwargs['validate_slug']) | ||||
|         login_url = reverse('hosting:login') | ||||
|         if validated: | ||||
|             message= _("Your account has been activated. You can now ") + '<a href="' + login_url +'">login</a>' | ||||
|             section_title=_('Account activation') | ||||
|         else: | ||||
|             message= _("Sorry. Your request is invalid.") + '<a href="' + login_url +'">login</a>' | ||||
|             section_title=_('Account activation') | ||||
|         context['message'] = mark_safe(message) | ||||
|         context['section_title'] = section_title | ||||
|         return context | ||||
| 
 | ||||
| 
 | ||||
| class PasswordResetView(PasswordResetViewMixin): | ||||
|  |  | |||
|  | @ -1,8 +1,4 @@ | |||
| from datetime import datetime | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| from django.db import models | ||||
| from django.utils.translation import ugettext_lazy as _ | ||||
| from django.contrib.auth.models import User, AbstractBaseUser, BaseUserManager, AbstractUser, PermissionsMixin | ||||
|  | @ -13,6 +9,8 @@ from django.contrib.sites.models import Site | |||
| 
 | ||||
| from utils.stripe_utils import StripeUtils | ||||
| from utils.mailer import DigitalGlarusRegistrationMailer | ||||
| from django.core.urlresolvers import reverse | ||||
| from utils.mailer import BaseEmail | ||||
| 
 | ||||
| REGISTRATION_MESSAGE = {'subject': "Validation mail", | ||||
|                         'message': 'Please validate Your account under this link http://localhost:8000/en-us/digitalglarus/login/validate/{}', | ||||
|  | @ -75,13 +73,27 @@ class CustomUser(AbstractBaseUser, PermissionsMixin): | |||
|     REQUIRED_FIELDS = ['name', 'password'] | ||||
| 
 | ||||
|     @classmethod | ||||
|     def register(cls, name, password, email): | ||||
|     def register(cls, name, password, email, app='digital_glarus', base_url=None): | ||||
|         user = cls.objects.filter(email=email).first() | ||||
|         if not user: | ||||
|             user = cls.objects.create_user(name=name, email=email, password=password) | ||||
|             if user: | ||||
|                 dg = DigitalGlarusRegistrationMailer(user.validation_slug) | ||||
|                 dg.send_mail(to=user.email) | ||||
|                 if app == 'digital_glarus': | ||||
|                     dg = DigitalGlarusRegistrationMailer(user.validation_slug) | ||||
|                     dg.send_mail(to=user.email) | ||||
|                 elif app == 'dcl': | ||||
|                     user.is_active = False | ||||
|                     email_data = { | ||||
|                         'subject': _('Activate your Data Center Light account'), | ||||
|                         'from_address': '(Data Center Light) Data Center Light Support <support@datacenterlight.ch>', | ||||
|                         'to': user.email, | ||||
|                         'context': {'base_url'  : base_url,  | ||||
|                                     'activation_link' : reverse('hosting:validate', kwargs={'validate_slug': user.validation_slug})}, | ||||
|                         'template_name': 'user_activation', | ||||
|                         'template_path': 'datacenterlight/emails/' | ||||
|                     } | ||||
|                     email = BaseEmail(**email_data) | ||||
|                     email.send() | ||||
|                 return user | ||||
|             else: | ||||
|                 return None | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue