Пример #1
0
def verify_email(user):
    """
    For verifying an email address
    """
    from r2.lib.pages import VerifyEmail
    user.email_verified = False
    user._commit()
    Award.take_away("verified_email", user)

    token = EmailVerificationToken._new(user)
    emaillink = 'http://' + g.domain + '/verification/' + token._id
    g.log.debug("Generated email verification link: " + emaillink)

    _system_email(
        user.email,
        VerifyEmail(user=user, emaillink=emaillink).render(style='email'),
        Email.Kind.VERIFY_EMAIL)
Пример #2
0
def verify_email(user, dest):
    """
    For verifying an email address
    """
    from r2.lib.pages import VerifyEmail
    key = passhash(user.name, user.email)
    user.email_verified = False
    user._commit()
    Award.take_away("verified_email", user)
    emaillink = ('http://' + g.domain + '/verification/' + key
                 + query_string(dict(dest=dest)))
    g.log.debug("Generated email verification link: " + emaillink)
    g.cache.set("email_verify_%s" %key, user._id, time=1800)

    _system_email(user.email,
                  VerifyEmail(user=user,
                              emaillink = emaillink).render(style='email'),
                  Email.Kind.VERIFY_EMAIL)
Пример #3
0
def verify_email(user, dest=None):
    """
    For verifying an email address
    """
    from r2.lib.pages import VerifyEmail
    user.email_verified = False
    user._commit()
    Award.take_away("verified_email", user)

    token = EmailVerificationToken._new(user)
    base = g.https_endpoint or g.origin
    emaillink = base + '/verification/' + token._id
    if dest:
        emaillink += '?dest=%s' % dest
    g.log.debug("Generated email verification link: " + emaillink)

    _system_email(
        user.email,
        VerifyEmail(user=user, emaillink=emaillink).render(style='email'),
        Email.Kind.VERIFY_EMAIL)