Commit d08f6fb93496f40804dacfb89950f55b14609255

Authored by Chung Wang
1 parent abb2506d35
Exists in master

In PATCH, added email confirmation

Showing 1 changed file with 10 additions and 2 deletions Side-by-side Diff

flashcards/api.py View file @ d08f6fb
... ... @@ -25,8 +25,16 @@
25 25 if not currentuser.check_password(request.data['old_password']):
26 26 raise ValidationError('Invalid old password')
27 27  
28   - currentuser.set_password(request.data['new_password'])
29   - currentuser.save()
  28 + send_mail("Please verify your Flashy account",
  29 + body % currentuser.confirmation_key,
  30 + "noreply@flashy.cards",
  31 + [currentuser.email])
  32 +
  33 + currentuser.confirm_email( currentuser.confirmation_key )
  34 +
  35 + if currentuser.isconfirmed
  36 + currentuser.set_password(request.data['new_password'])
  37 + currentuser.save()
30 38  
31 39 return Response(status=status.HTTP_204_NO_CONTENT)
32 40