def credentials_view(request): auth_code = generate_code(request.user) return render_to_response(CREDENTIALS_TEMPLATE, { "user": request.user, "auth_code": auth_code, "expires_in": AUTH_CODE_TIMEOUT, "qr_url": reverse("easylogin_qr", authCode=auth_code), })
def credentials_view(request): auth_code = generate_code(request.user) return render_to_response( CREDENTIALS_TEMPLATE, { "user": request.user, "auth_code": auth_code, "expires_in": AUTH_CODE_TIMEOUT, "qr_url": reverse("easylogin_qr", authCode=auth_code), })
def gen_qr_code(request): auth_code = request.GET.get("authCode") if not auth_code: auth_code = generate_code(request.user) current_site = get_current_site(request) scheme = request.is_secure() and "https" or "http" login_link = "".join([ scheme, "://", current_site.domain, reverse("easylogin_code_login", authCode=auth_code), ]) img = qrcode.make(login_link) response = HttpResponse(mimetype="image/png") img.save(response, "PNG") return response