@@ -115,18 +115,7 @@ def create_account(request):
115115 ok_to_create = ( Whitelisted .objects .filter (email = to_email ).exists ()
116116 or existing and (existing .time + TimeDelta (seconds = settings .LIST_ACCOUNT_DELAY )) < DateTime .now () )
117117 if ok_to_create :
118- auth = django .core .signing .dumps (to_email , salt = "create_account" )
119-
120- domain = Site .objects .get_current ().domain
121- subject = 'Confirm registration at %s' % domain
122- from_email = settings .DEFAULT_FROM_EMAIL
123-
124- send_mail (request , to_email , from_email , subject , 'registration/creation_email.txt' , {
125- 'domain' : domain ,
126- 'auth' : auth ,
127- 'username' : to_email ,
128- 'expire' : settings .DAYS_TO_EXPIRE_REGISTRATION_LINK ,
129- })
118+ send_account_creation_email (request , to_email )
130119 else :
131120 return render (request , 'registration/manual.html' , { 'account_request_email' : settings .ACCOUNT_REQUEST_EMAIL })
132121 else :
@@ -137,6 +126,19 @@ def create_account(request):
137126 'to_email' : to_email ,
138127 })
139128
129+ def send_account_creation_email (request , to_email ):
130+ auth = django .core .signing .dumps (to_email , salt = "create_account" )
131+ domain = Site .objects .get_current ().domain
132+ subject = 'Confirm registration at %s' % domain
133+ from_email = settings .DEFAULT_FROM_EMAIL
134+ send_mail (request , to_email , from_email , subject , 'registration/creation_email.txt' , {
135+ 'domain' : domain ,
136+ 'auth' : auth ,
137+ 'username' : to_email ,
138+ 'expire' : settings .DAYS_TO_EXPIRE_REGISTRATION_LINK ,
139+ })
140+
141+
140142def confirm_account (request , auth ):
141143 try :
142144 email = django .core .signing .loads (auth , salt = "create_account" , max_age = settings .DAYS_TO_EXPIRE_REGISTRATION_LINK * 24 * 60 * 60 )
0 commit comments