Skip to content

Commit

Permalink
added verify route
Browse files Browse the repository at this point in the history
  • Loading branch information
valid22 committed Jan 10, 2022
1 parent e6cbda8 commit a295431
Show file tree
Hide file tree
Showing 24 changed files with 1,082 additions and 27 deletions.
Binary file added cert/template/basic/AdobeCleanUXLight.otf
Binary file not shown.
Binary file added cert/template/basic/Group 28.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cert/template/basic/Helvetica.ttf
Binary file not shown.
Binary file added cert/template/basic/Minion Variable Concept.otf
Binary file not shown.
Binary file added cert/template/basic/horizontal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
215 changes: 215 additions & 0 deletions cert/template/basic/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
/* define all fonts */
@import url('https://fonts.googleapis.com/css2?family=Great+Vibes&family=Montserrat&family=Roboto:wght@400;900&display=swap');

@font-face {
font-family: 'MinionVariableConcept-Roman';
src: url('Minion\ Variable\ Concept.otf');
}

@font-face {
font-family: 'Helvetica';
src: url('Helvetica.ttf');
}

@page {
size: A4; /* Change from the default size of A4 */
margin: 0mm; /* Set margin on each page */
}

@media print {
body {-webkit-print-color-adjust: exact;}
}

/* define page style*/

html {
top: 0;
left: 0;
}

.main {
position: absolute;
top: 0;
left: 0;
width: 798px;
height: 1123px;
background: transparent url('Group 28.png') 0% 0% no-repeat padding-box;
opacity: 1;
}

.group-1 {
position: relative;
top: 278px;
left: 134px;
width: 532px;
height: 75px;
text-align: center;
letter-spacing: 0px;
color: #000000;
opacity: 1;
}

.group-1 .title-1 {
position: absolute;
top: 0px;
left: 0.02099609375px;
width: 532px;
height: 39px;
text-align: center;
letter-spacing: 0px;
color: #000000;

font-family: 'Roboto', sans-serif;
font-size: 30px;
font-weight: 900;
}

.group-1 .title-2 {
position: absolute;
top: 36px;
left: 10px;
width: 512px;
height: 39px;
text-align: center;
letter-spacing: 0px;
color: #000000;

font-family: 'Roboto', sans-serif;
font-size: 30px;
font-weight: 400;
}

.group-2 {
position: relative;
top: 30px;
left: 0px;
width: 446px;
height: 150px;
text-align: center;
letter-spacing: 0px;
color: #000000;
opacity: 1;
}

.group-2 .title-1 {
position: relative;
top: 0px;
left: 0px;
width: 446px;
height: 109px;
text-align: center;
letter-spacing: 0px;
color: #000000;

font-family: 'MinionVariableConcept-Roman';
font-size: 82px;
font-weight: 800;
}

.group-2 .title-2 {
position: relative;
top: -10px;
left: 30px;
width: 446px;
height: 54px;
text-align: center;
letter-spacing: 0px;
color: #000000;

font-family: 'MinionVariableConcept-Roman';
font-size: 41px;
font-weight: 700;
}

.group-3 {
position: relative;
top: 29px;
left: -25px;
width: 485px;
height: 42px;
text-align: center;
letter-spacing: 1px;
color: #000000;
opacity: 1;

font-family: 'Montserrat', sans-serif;
font-size: 34px;
}

.group-4 {
position: relative;
top: 55px;
left: -186px;
width: 790px;
height: 125px;
text-align: center;
letter-spacing: 0px;
color: #D5A54D;
opacity: 1;
}

.group-4 .text {
font-family: 'Great Vibes', sans-serif;
font-size: 60px;
font-weight: 400;
}

.group-5 {
position: relative;
top: 37px;
left: -135px;
width: 726px;
height: 120px;
text-align: center;
letter-spacing: 0px;
color: #000000;
opacity: 1;
}

.group-5 .text {
font-family: 'Helvetica', sans-serif;
font-size: 30px;
font-weight: 400;
}


.signature {
position: absolute;
width: 300px;
background-image: url('horizontal.png');
background-repeat: no-repeat;
background-position: top;

font-family: 'Helvetica', sans-serif;
font-size: 21px;
font-weight: 500;
}

.signature .below-signature {
padding-top: 25px;
}

.signature .above-signature {
position: relative;
top: -159px;
left: -2px;
}

.above-signature img {
max-width: 180px;
max-height: 95px;
}

.qr-code-mid {
position: absolute;
top: 408px;
left: 172px;
width: 100px;
}

.qr-code-mid-below {
position: absolute;
top: 524px;
left: 172px;
width: 100px;
}
74 changes: 74 additions & 0 deletions cert/template/basic/template.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<!DOCTYPE html>
<html lang="en">
<head>
{% block head %}
<meta charset="utf-8">
<meta name="description" content="IITM-PODCertification">

{# Cert type - Participation, Excellence, etc..#}
<title>IITM-POD - {{cert_type | title}} Certification</title>

<link href="main.css" rel="stylesheet">
{% endblock %}
</head>
<body>
{% block body %}
<div class="main">
<div class="group-1">
<div class="title-1">Indian Institute of Techonology Madras</div>
<div class="title-2">BSc in Programming and Data Science<div>
</div>
<div class="group-2 ">
<div class="title-1">CERTIFICATE</div>
<div class="title-2">OF {{cert_type | upper}}<div>
</div>
<div class="group-3">
PROUDLY PRESENTED TO
</div>
<div class="group-4">
<div class="text">{{name}}</div>
</div>
<div class="group-5">
<div class="text">{{cert_desc}}</div>
</div>

{% if (signatures | length) == 2%}
<div class="signature" style="top: 454px; left: -143px;" id="left">
<div class="below-signature">
<b>{{signatures[0].name | upper}}</b> <br>
<span style="font-size: 17px;">{{signatures[0].title | upper}}</span>
</div>
<div class="above-signature">
<img src="{{signatures[0].url}}">
</div>
</div>

<div class="signature" style="top: 454px; left: 293px;" id="right">
<div class="below-signature">
<b>{{signatures[1].name | upper}}</b> <br>
<span style="font-size: 17px;">{{signatures[1].title | upper}}</span>
</div>
<div class="above-signature">
<img src="{{signatures[1].url}}">
</div>
</div>

<img class='qr-code-mid' src="{{qr_code}}">
{% elif (signatures | length) == 1 %}
<div class="signature" style="top: 454px; left: 75px;" id="center">
<div class="below-signature">
<b>{{signatures[0].name | upper}}</b> <br>
<span style="font-size: 17px;">{{signatures[0].title | upper}}</span>
</div>
<div class="above-signature">
<img src="{{signatures[0].url}}">
</div>
</div>
<img class='qr-code-mid-below' src="{{qr_code}}">
{% endif %}
</div>
{% endblock %}

{% block body_end%} {% endblock %}
</body>
</html>
16 changes: 16 additions & 0 deletions certify/constants/cert.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from enum import Enum


class CertType(Enum):
PARTICIPATION = "Participation"
EXCELLENCE = "Excellence"

def __str__(self):
return self.value


class CertTemplate(Enum):
BASIC = "basic"

def __str__(self):
return self.value
17 changes: 9 additions & 8 deletions certify/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from starlette.config import Config
from starlette.datastructures import CommaSeparatedStrings, Secret, URL

from certify.core.logging import InterceptHandler
from certify.constants.jwt import JWTTokenType

config = Config(".env")
Expand All @@ -26,10 +25,12 @@
"DEFAULT_TOKEN_EXPIRE", cast=int, default=15 * 60)
JWT_ALGORITHM = config("DEFAULT_TOKEN_EXPIRE",
cast=JWTTokenType, default="HS256")

logging.getLogger().handlers = [InterceptHandler()]
LOGGERS = ("uvicorn.asgi", "uvicorn.access")
for logger_name in LOGGERS:
logging_logger = logging.getLogger(logger_name)
logging_logger.setLevel(logging.INFO)
logging_logger.handlers = [InterceptHandler(level=LOGGING_LEVEL)]
FIRESTORE_PROJECT_ID = config(
"FIRESTORE_PROJECT_ID", cast=str, default="iitmadrascert"
)
STORAGE_PROJECT_ID = config(
"FIRESTORE_PROJECT_ID", cast=str, default="iitmadrascert"
)
STORAGE_BUCKET = config(
"STORAGE_BUCKET", cast=str, default="iitmadrascert.appspot.com"
)
3 changes: 1 addition & 2 deletions certify/core/error/http_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ async def http_error_handler(_: Request, exc: HTTPException) -> JSONResponse:
if isinstance(exc.detail, BaseModel):
return JSONResponse(
{
"has_error": True,
"success": False,
"data": None,
"error": jsonable_encoder(exc.detail),
Expand All @@ -25,7 +24,7 @@ async def http_error_handler(_: Request, exc: HTTPException) -> JSONResponse:
)

return JSONResponse(
{"has_error": True, "success": False,
{"success": False,
"data": None, "error": str(exc.detail)},
status_code=exc.status_code,
)
2 changes: 1 addition & 1 deletion certify/core/error/validation_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ async def http422_error_handler(
JSONResponse
"""
return JSONResponse(
{"has_error": True, "success": False, "data": None, "error": exc.errors()},
{"success": False, "data": None, "error": exc.errors()},
status_code=HTTP_422_UNPROCESSABLE_ENTITY,
)

Expand Down
Loading

0 comments on commit a295431

Please sign in to comment.