Пример #1
0
def resend_confirmation_mail(request):
    logger.info("Re-sending verification mail for user %s" % str(request.user))
    success = False

    if request.user.is_authenticated():
        # If the user is authenticated, then resend the mail only if the account is not verified
        if not request.user.verified:
            logger.debug("%s account is inactive" % str(request.user))
            name = request.user.name
            email = request.user.email
            token = request.user.get_email_confirmation_token()

            logger.debug("Sending verification mail to user %s with token %s" % (str(request.user), str(token)))
            mail.send_confirmation_mail(str(name), str(email), str(token))
            success = True

    logger.info("Sending response(resend_confirmation_mail)")
    return simplejson.dumps({"success": success})
Пример #2
0
def default_tabs(sender, **kwargs):
	user = kwargs.get('instance', None)
	created = kwargs.get('created', None)

	#If it was a newly created record
	if created and user:
		#Create default tab
		logger.debug("Creating default tabs for user %s" % str(user))
		tab = Tab.objects.create_tab(user=user, name='Headlines')
		source = get_object_or_none(Source, name='CNN-IBN Top Stories')
		if source:
			tab.add_source(source)
			logger.debug("Default tab created successfuly")

		logger.debug("Sending confirmation email to user %s" % str(user))
		token = user.get_email_confirmation_token()
		mail.send_confirmation_mail(str(user.name), str(user.email), str(token))
		logger.debug("Mail sent to %s" % str(user.email))