Beispiel #1
0
def admin_request_password_reset(request):
    portunus_uuid = request.data.get("portunus_uuid")
    if not portunus_uuid:
        return make_response(False)

    try:
        user = User.objects.get(portunus_uuid=portunus_uuid)
    except User.DoesNotExist:
        return make_response(False)

    PortunusMailer.send_password_reset(user)
    return make_response()
Beispiel #2
0
def request_password_reset(request):
    email = request.data.get("email")
    if not email:
        return make_response(False)

    try:
        user = User.objects.get(email=email.lower())
    except User.DoesNotExist:
        # Send back success even if the account DNE to avoid leaking user emails.
        return make_response()

    PortunusMailer.send_password_reset(user)
    return make_response()
Beispiel #3
0
def request_password_reset(request):
    email = request.data.get("email")
    if not email:
        return make_response(False)

    try:
        user = User.objects.get(email=email.lower())
    except User.DoesNotExist:
        # Send back success even if the account DNE to avoid leaking user emails.
        extra_data = {
            "success": False,
            "email": email,
            "error": "Matching user does not exist",
        }
        log_event("request_password_reset", request, extra_data=extra_data)
        return make_response()

    PortunusMailer.send_password_reset(user)
    log_event("request_password_reset", request, extra_data={"success": True})
    return make_response()