Skip to content

Commit

Permalink
enabled OAuth
Browse files Browse the repository at this point in the history
  • Loading branch information
valid22 committed Jan 13, 2022
1 parent 0f9a755 commit f6fba1b
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
11 changes: 11 additions & 0 deletions cert/template/basic/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -212,4 +212,15 @@ html {
top: 524px;
left: 172px;
width: 100px;
}

.cert-id-txt {
position: absolute;
top: 597px;
left: 439px;
width: 100px;
font-size: 0.4em;
color: white;
font-weight: 100;
font-family: 'MinionVariableConcept-Roman';
}
1 change: 1 addition & 0 deletions cert/template/basic/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
</div>
<img class='qr-code-mid-below' src="{{qr_code}}">
{% endif %}
<span class="cert-id-txt">{{cert_id}}</span>
</div>
{% endblock %}

Expand Down
2 changes: 1 addition & 1 deletion certify/core/middleware/jwt.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ async def __call__(self, scope: Scope, receive: Receive, send: Send):
scope["oauth"] = payload

except:
pass
scope["oauth"] = None

await self._app(scope, receive, send)

Expand Down
2 changes: 1 addition & 1 deletion certify/routes/api/v1/cert.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

@router.post("/add", response_model=CertificateResponse,
responses={status.HTTP_401_UNAUTHORIZED: {'model': OAuthTokenError}, status.HTTP_500_INTERNAL_SERVER_ERROR: {'model': CertificateErrorResponse}},
#dependencies=[require_oauth_scopes(Scope.CreateCert)]
dependencies=[require_oauth_scopes(Scope.CreateCert)]
)
async def certificate_verify(
request: Request,
Expand Down
2 changes: 1 addition & 1 deletion certify/utils/cert.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ async def generate_certificate(data: CertificateModel) -> BytesIO:
template = await f.read()

template = Template(template)
template = template.render(cert_type=data.type, name=data.data.name.title(), cert_desc=data.data.desc, signatures=data.data.signatures, qr_code=data.qr)
template = template.render(cert_type=data.type, name=data.data.name.title(), cert_desc=data.data.desc, signatures=data.data.signatures, qr_code=data.qr, cert_id=data.id)

cert_pdf = await generate_pdf_from_template(template, cert_template)
return cert_pdf
Expand Down

0 comments on commit f6fba1b

Please sign in to comment.