コード例 #1
0
ファイル: tasks.py プロジェクト: 1npo/cornerwise
def send_user_key(user_id):
    profile = UserProfile.objects.get(user_id=user_id)
    if not profile.token:
        profile.generate_token()

    # Render HTML and text templates:
    context = {"confirm_url": make_absolute_url(profile.manage_url)}
    send_mail(profile.user, "Cornerwise: Please confirm your email",
              "confirm", context)
コード例 #2
0
ファイル: tasks.py プロジェクト: Bachmann1234/cornerwise
def send_user_key(user_id):
    profile = UserProfile.objects.get(user_id=user_id)
    if not profile.token:
        profile.generate_token()

    # Render HTML and text templates:
    context = {"confirm_url": make_absolute_url(profile.manage_url)}
    send_mail(profile.user, "Cornerwise: Please confirm your email", "confirm",
              context)
コード例 #3
0
ファイル: tasks.py プロジェクト: morisy/cornerwise
def send_user_key(user):
    profile = user.profile
    if not profile.token:
        profile.generate_token()

    # Render HTML and text templates:
    path = reverse("user-login", kwargs={"token": profile.token,
                                         "pk": user.pk})
    context = {"confirm_url": make_absolute_url(path)}
    send_mail(user, "Cornerwise: Please confirm your email",
              "confirm", context)
コード例 #4
0
ファイル: mail.py プロジェクト: knweber/cornerwise
def welcome_context(subscription):
    """Constructs the context for rendering the welcome email.
    """
    user = subscription.user
    profile = user.profile
    if not profile.token:
        profile.generate_token()

    return {
        "confirm_url": make_absolute_url(profile.confirm_url),
        "minimap_src": subscription.minimap_src,
        "subscription-preview": subscription.minimap_src
    }
コード例 #5
0
ファイル: mail.py プロジェクト: knweber/cornerwise
def confirmation_context(subscription):
    try:
        user = subscription.user
        existing = user.subscriptions.filter(active=True).exists()
    except IndexError:
        # The user doesn't have any active Subscriptions
        return
    return {
        "subscription": subscription.readable_description,
        "minimap_src": subscription.minimap_src,
        "subscription-preview": subscription.minimap_src,
        "old_minimap_src": existing.minimap_src,
        "confirmation_link": make_absolute_url(subscription.confirm_url)
    }
コード例 #6
0
ファイル: mail.py プロジェクト: knweber/cornerwise
def _make_user_context(user, context):
    context = context.copy() if context else {}
    context["user"] = user.profile.addressal
    context["unsubscribe_url"] = make_absolute_url(
        user.profile.unsubscribe_url)
    return context
コード例 #7
0
def absolutize(url):
    return make_absolute_url(url)