Example #1
0
def send_email_reminder(request):
    """Send reminder email."""
    statsd_waffle_incr('users.send_email_reminder', 'signin_metrics')
    if request.method == 'POST':
        statsd_waffle_incr('users.send_email_reminder.POST', 'signin_metrics')
        form = EmailReminderForm(request.POST)
        if form.is_valid():
            error = None
            username = form.cleaned_data['username']
            try:
                user = User.objects.get(username=username, is_active=True)
                if user.email:
                    # TODO: should this be on a model or manager instead?
                    statsd_waffle_incr('users.send_email_reminder.SUCCESS',
                                      'signin_metrics')
                    send_reminder_email(user)
                else:
                    statsd_waffle_incr('users.send_email_reminder.NOEMAIL',
                                      'signin_metrics')
                    error = 'no_email'
            except User.DoesNotExist:
                # Don't leak existence of email addresses.
                statsd_waffle_incr('users.send_email_reminder.NOUSER',
                                  'signin_metrics')
            return jingo.render(request,
                                'users/send_email_reminder_done.html',
                                {'username': username, 'error': error})
    else:
        form = EmailConfirmationForm()
    return jingo.render(request, 'users/resend_confirmation.html',
                        {'form': form})
Example #2
0
def send_email_reminder(request):
    """Send reminder email."""
    statsd_waffle_incr('users.send_email_reminder', 'signin_metrics')
    if request.method == 'POST':
        statsd_waffle_incr('users.send_email_reminder.POST', 'signin_metrics')
        form = EmailReminderForm(request.POST)
        if form.is_valid():
            error = None
            username = form.cleaned_data['username']
            try:
                user = User.objects.get(username=username, is_active=True)
                if user.email:
                    # TODO: should this be on a model or manager instead?
                    statsd_waffle_incr('users.send_email_reminder.SUCCESS',
                                      'signin_metrics')
                    send_reminder_email(user)
                else:
                    statsd_waffle_incr('users.send_email_reminder.NOEMAIL',
                                      'signin_metrics')
                    error = 'no_email'
            except User.DoesNotExist:
                # Don't leak existence of email addresses.
                statsd_waffle_incr('users.send_email_reminder.NOUSER',
                                  'signin_metrics')
            return render(request, 'users/send_email_reminder_done.html',
                          {'username': username, 'error': error})
    else:
        form = EmailConfirmationForm()
    return render(request, 'users/resend_confirmation.html', {'form': form})
Example #3
0
def send_email_reminder(request):
    """Send reminder email."""
    statsd_waffle_incr("users.send_email_reminder", "signin_metrics")
    if request.method == "POST":
        statsd_waffle_incr("users.send_email_reminder.POST", "signin_metrics")
        form = EmailReminderForm(request.POST)
        if form.is_valid():
            error = None
            username = form.cleaned_data["username"]
            try:
                user = User.objects.get(username=username, is_active=True)
                if user.email:
                    # TODO: should this be on a model or manager instead?
                    statsd_waffle_incr("users.send_email_reminder.SUCCESS", "signin_metrics")
                    send_reminder_email(user)
                else:
                    statsd_waffle_incr("users.send_email_reminder.NOEMAIL", "signin_metrics")
                    error = "no_email"
            except User.DoesNotExist:
                # Don't leak existence of email addresses.
                statsd_waffle_incr("users.send_email_reminder.NOUSER", "signin_metrics")
            return jingo.render(request, "users/send_email_reminder_done.html", {"username": username, "error": error})
    else:
        form = EmailConfirmationForm()
    return jingo.render(request, "users/resend_confirmation.html", {"form": form})
Example #4
0
def send_email_reminder(request):
    """Send reminder email."""
    if request.method == 'POST':
        form = EmailReminderForm(request.POST)
        if form.is_valid():
            username = form.cleaned_data['username']
            try:
                user = User.objects.get(username=username, is_active=True)
                # TODO: should this be on a model or manager instead?
                send_reminder_email(user)
            except User.DoesNotExist:
                # Don't leak existence of email addresses.
                pass
            return jingo.render(request, 'users/send_email_reminder_done.html',
                                {'username': username})
    else:
        form = EmailConfirmationForm()
    return jingo.render(request, 'users/resend_confirmation.html',
                        {'form': form})
Example #5
0
def send_email_reminder(request):
    """Send reminder email."""
    if request.method == 'POST':
        form = EmailReminderForm(request.POST)
        if form.is_valid():
            username = form.cleaned_data['username']
            try:
                user = User.objects.get(username=username, is_active=True)
                # TODO: should this be on a model or manager instead?
                send_reminder_email(user)
            except User.DoesNotExist:
                # Don't leak existence of email addresses.
                pass
            return jingo.render(request,
                                'users/send_email_reminder_done.html',
                                {'username': username})
    else:
        form = EmailConfirmationForm()
    return jingo.render(request, 'users/resend_confirmation.html',
                        {'form': form})
Example #6
0
File: views.py Project: Arveti/kuma
def send_email_reminder(request):
    """Send reminder email."""
    if request.method == 'POST':
        form = EmailReminderForm(request.POST)
        if form.is_valid():
            error = None
            username = form.cleaned_data['username']
            try:
                user = User.objects.get(username=username, is_active=True)
                if user.email:
                    send_reminder_email(user)
                else:
                    error = 'no_email'
            except User.DoesNotExist:
                # Don't leak existence of email addresses.
                pass
            return render(request, 'users/send_email_reminder_done.html',
                          {'username': username, 'error': error})
    else:
        form = EmailConfirmationForm()
    return render(request, 'users/resend_confirmation.html', {'form': form})
Example #7
0
def send_email_reminder(request):
    """Send reminder email."""
    if request.method == 'POST':
        form = EmailReminderForm(request.POST)
        if form.is_valid():
            error = None
            username = form.cleaned_data['username']
            try:
                user = User.objects.get(username=username, is_active=True)
                if user.email:
                    send_reminder_email(user)
                else:
                    error = 'no_email'
            except User.DoesNotExist:
                # Don't leak existence of email addresses.
                pass
            return render(request, 'users/send_email_reminder_done.html', {
                'username': username,
                'error': error
            })
    else:
        form = EmailConfirmationForm()
    return render(request, 'users/resend_confirmation.html', {'form': form})