from writers import manage_pending_data
+from forum.actions import EmailValidationAction
from forum.utils import html
from forum.views.decorators import login_required
from forum.modules import decorate
user = get_object_or_404(User, id=user)
if (ValidationHash.objects.validate(code, user, 'email', [user.email])):
- user.email_isvalid = True
- user.save()
+ EmailValidationAction(user=user, ip=request.META['REMOTE_ADDR']).save()
return login_and_forward(request, user, reverse('index'), _("Thank you, your email is now validated."))
else:
return render_to_response('auth/mail_already_validated.html', { 'user' : user }, RequestContext(request))
def award_to(self, action):
return None
+class ValidatedEmail(AbstractBadge):
+ type = Badge.BRONZE
+ listen_to = (EmailValidationAction,)
+ name = _("Validated Email")
+ description = _("User who has validated email associated to the account")
+
+ def award_to(self, action):
+ return action.user
\ No newline at end of file