Revision c9972f0f
b/pithos/im/views.py | ||
---|---|---|
229 | 229 |
defaults={'code': code, 'realname': realname}) |
230 | 230 |
|
231 | 231 |
try: |
232 |
send_invitation(request.get_host(), invitation)
|
|
232 |
send_invitation(request.build_absolute_uri('/').rstrip('/'), invitation)
|
|
233 | 233 |
if created: |
234 | 234 |
inviter.invitations = max(0, inviter.invitations - 1) |
235 | 235 |
inviter.save() |
... | ... | |
257 | 257 |
return HttpResponse(html) |
258 | 258 |
|
259 | 259 |
def send_verification(baseurl, user): |
260 |
next = quote('http://%s' % baseurl) |
|
261 | 260 |
url = settings.ACTIVATION_LOGIN_TARGET % (baseurl, |
262 | 261 |
quote(user.auth_token), |
263 |
next)
|
|
262 |
quote(baseurl))
|
|
264 | 263 |
message = render_to_string('activation.txt', { |
265 | 264 |
'user': user, |
266 | 265 |
'url': url, |
... | ... | |
309 | 308 |
user.level = 1 |
310 | 309 |
user.renew_token() |
311 | 310 |
try: |
312 |
send_verification(request.get_host(), user)
|
|
311 |
send_verification(request.build_absolute_uri('/').rstrip('/'), user)
|
|
313 | 312 |
message = _('Verification sent to %s' % user.email) |
314 | 313 |
user.save() |
315 | 314 |
except (SMTPException, socket.error) as e: |
... | ... | |
324 | 323 |
return response |
325 | 324 |
|
326 | 325 |
def send_password(baseurl, user): |
327 |
next = quote('http://%s' % baseurl) |
|
328 | 326 |
url = settings.PASSWORD_RESET_TARGET % (baseurl, |
329 | 327 |
quote(user.uniq), |
330 |
next)
|
|
328 |
quote(baseurl))
|
|
331 | 329 |
message = render_to_string('password.txt', { |
332 | 330 |
'user': user, |
333 | 331 |
'url': url, |
... | ... | |
347 | 345 |
try: |
348 | 346 |
user = User.objects.get(uniq=username) |
349 | 347 |
try: |
350 |
send_password(request.get_host(), user)
|
|
348 |
send_password(request.build_absolute_uri('/').rstrip('/'), user)
|
|
351 | 349 |
status = 'success' |
352 | 350 |
message = _('Password reset sent to %s' % user.email) |
353 | 351 |
user.status = 'UNVERIFIED' |
b/pithos/settings.py.dist | ||
---|---|---|
190 | 190 |
SERVICE_NAME = 'Pithos+' |
191 | 191 |
|
192 | 192 |
# Where users should login with their invitation code |
193 |
INVITATION_LOGIN_TARGET = 'http://%s/im/login/invitation' \
|
|
193 |
INVITATION_LOGIN_TARGET = '%s/im/login/invitation' \ |
|
194 | 194 |
'?code=%d' \ |
195 | 195 |
'&next=%s' |
196 | 196 |
|
197 | 197 |
# Where users should activate their local account |
198 |
ACTIVATION_LOGIN_TARGET = 'http://%s/im/local/activate/' \
|
|
198 |
ACTIVATION_LOGIN_TARGET = '%s/im/local/activate/' \ |
|
199 | 199 |
'?auth=%s' \ |
200 | 200 |
'&next=%s' |
201 | 201 |
|
202 | 202 |
# Where users should reset their local password |
203 |
PASSWORD_RESET_TARGET = 'http://%s/im/local/reset/' \
|
|
203 |
PASSWORD_RESET_TARGET = '%s/im/local/reset/' \ |
|
204 | 204 |
'?username=%s' \ |
205 | 205 |
'&next=%s' |
206 | 206 |
|
Also available in: Unified diff