From 510a56aa17b8175cb74e63d2fbde4789855a68d6 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 13 Apr 2020 18:30:40 -0400 Subject: [PATCH 1/3] Update challenge_daily_email.html --- .../templates/challenge_daily_email.html | 116 ++++++++++-------- 1 file changed, 63 insertions(+), 53 deletions(-) diff --git a/CodeChallenge/templates/challenge_daily_email.html b/CodeChallenge/templates/challenge_daily_email.html index b3d61f6..55b0112 100644 --- a/CodeChallenge/templates/challenge_daily_email.html +++ b/CodeChallenge/templates/challenge_daily_email.html @@ -16,11 +16,11 @@ box-sizing: border-box; font-size: 14px; } - +​ img { max-width: 100%; } - +​ body { -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; @@ -30,24 +30,24 @@ /* 1.6em * 14px = 22.4px, use px to get airier line-height also in Thunderbird, and Yahoo!, Outlook.com, AOL webmail clients */ /*line-height: 22px;*/ } - +​ /* Let's make sure all tables have defaults */ table td { vertical-align: top; } - +​ /* ------------------------------------- BODY & CONTAINER ------------------------------------- */ body { background-color: #353535; } - +​ .body-wrap { background-color: #353535; width: 100%; } - +​ .container { display: block !important; max-width: 600px !important; @@ -55,14 +55,14 @@ /* makes it centered */ clear: both !important; } - +​ .content { max-width: 600px; margin: 0 auto; display: block; padding: 20px; } - +​ /* ------------------------------------- HEADER, FOOTER, MAIN ------------------------------------- */ @@ -70,15 +70,15 @@ background-color: #fff; border-radius: 3px; } - +​ .content-wrap { padding: 40px; } - +​ .content-block { padding: 0 0 20px; } - +​ .header { width: 100%; margin-bottom: 20px; @@ -86,23 +86,23 @@ padding: 20px; color: #fff; } - +​ .header h3 { color: #fff; } - +​ .footer { width: 100%; clear: both; color: #999; padding: 20px; } - +​ .footer p, .footer a, .footer td { color: #999; font-size: 12px; } - +​ /* ------------------------------------- TYPOGRAPHY ------------------------------------- */ @@ -113,40 +113,40 @@ line-height: 1.2em; font-weight: 600; } - +​ h1 { font-size: 32px; /* 1.2em * 32px = 38.4px, use px to get airier line-height also in Thunderbird, and Yahoo!, Outlook.com, AOL webmail clients */ /*line-height: 38px;*/ } - +​ h2 { font-size: 24px; /* 1.2em * 24px = 28.8px, use px to get airier line-height also in Thunderbird, and Yahoo!, Outlook.com, AOL webmail clients */ /*line-height: 29px;*/ } - +​ h3 { font-size: 18px; /* 1.2em * 18px = 21.6px, use px to get airier line-height also in Thunderbird, and Yahoo!, Outlook.com, AOL webmail clients */ /*line-height: 22px;*/ } - +​ h4 { font-size: 14px; font-weight: 600; } - +​ p, ul, ol { margin-bottom: 10px; font-weight: normal; } - +​ p li, ul li, ol li { margin-left: 5px; list-style-position: inside; } - +​ /* ------------------------------------- LINKS & BUTTONS ------------------------------------- */ @@ -154,7 +154,7 @@ color: #348eda; text-decoration: underline; } - +​ .btn-primary { text-decoration: none; color: #FFF !important; @@ -171,39 +171,39 @@ border-radius: 5px; text-transform: capitalize; } - +​ /* ------------------------------------- OTHER STYLES THAT MIGHT BE USEFUL ------------------------------------- */ .last { margin-bottom: 0; } - +​ .first { margin-top: 0; } - +​ .aligncenter { text-align: center; } - +​ .alignright { text-align: right; } - +​ .alignleft { text-align: left; } - +​ .clear { clear: both; } - +​ .social { max-width: 25px; display: inline-block; } - +​ /* ------------------------------------- ALERTS Change the class depending on warning email, good email or bad email @@ -216,26 +216,26 @@ text-align: center; border-radius: 3px 3px 0 0; } - +​ .alert a { color: #fff; text-decoration: none; font-weight: 500; font-size: 10px; } - +​ .alert.alert-warning { background-color: #353535; } - +​ .alert.alert-bad { background-color: #D0021B; } - +​ .alert.alert-good { background-color: #0fad80; } - +​ /* ------------------------------------- RESPONSIVE AND MOBILE FRIENDLY STYLES ------------------------------------- */ @@ -243,46 +243,46 @@ body { padding: 0 !important; } - +​ h1, h2, h3, h4 { font-weight: 800 !important; margin: 20px 0 5px !important; } - +​ h1 { font-size: 22px !important; } - +​ h2 { font-size: 18px !important; } - +​ h3 { font-size: 16px !important; } - +​ .container { padding: 0 !important; width: 100% !important; } - +​ .content { padding: 0 !important; } - +​ .content-wrap { padding: 10px !important; } - +​ } - +​ /*# sourceMappingURL=styles.css.map */ - +​ - +​ - +​ @@ -301,20 +301,27 @@ + + + + +

{{name}}, today's code challenge question is unlocked!


-

Continue your quest by logging in.

+

Continue your quest by logging in.

Good luck and safe travels!


- ANSWER TODAY'S QUESTION + ANSWER TODAY'S QUESTION
-

Login to Play
+

Login to Play
Challenge Details
Prizes
- Frequently Asked Questions

+ Need Help? Get it on Discord, Facebook, and FAQs

+
+ Learn to Code with CodeWizardsHQ Today!
@@ -322,7 +329,6 @@

{{name}}, today's code challenge question is unlocked!

Share With Friends
- @@ -343,3 +349,7 @@

{{name}}, today's code challenge question is unlocked!

+Collapse + + + From 0b3169c0fb17090d0a56eee4117b10338b4a5de0 Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 14 Apr 2020 16:59:37 -0400 Subject: [PATCH 2/3] support FLASK_ENV='testing' --- application.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/application.py b/application.py index 34029b3..8a68e4d 100644 --- a/application.py +++ b/application.py @@ -6,10 +6,12 @@ from CodeChallenge import create_app -FLASK_ENV = os.environ.get("FLASK_ENV") +FLASK_ENV = os.getenv("FLASK_ENV") -if FLASK_ENV and FLASK_ENV == "development": +if FLASK_ENV == "development": cfg = "DevelopmentConfig" +elif FLASK_ENV == "testing": + cfg = "TestingConfig" else: cfg = "ProductionConfig" From 969bf1a7f6f1d79e1e8592d9c5a63f0814a6271e Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 14 Apr 2020 17:04:49 -0400 Subject: [PATCH 3/3] copy ProductionConfig as TestingConfig --- CodeChallenge/config.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/CodeChallenge/config.py b/CodeChallenge/config.py index a1dd8c8..dbad0f6 100644 --- a/CodeChallenge/config.py +++ b/CodeChallenge/config.py @@ -95,3 +95,24 @@ class DevelopmentConfig(ProductionConfig): @property def DIST_DIR(self): return os.path.join(self.ROOT_DIR, "dist") + + +class TestingConfig(DefaultConfig): + # read as much as possible from envvars + SQLALCHEMY_DATABASE_URI = os.getenv("SQLALCHEMY_DATABASE_URI") + SECRET_KEY = os.getenv("SECRET_KEY") + JWT_COOKIE_SECURE = True + JWT_SECRET_KEY = os.getenv("JWT_SECRET_KEY") + CODE_CHALLENGE_START = os.getenv("CODE_CHALLENGE_START") + MAIL_SUPPRESS_SEND = os.getenv("MAIL_SUPPRESS_SEND", False) + MAIL_USERNAME = os.getenv("MAIL_USERNAME") + MAIL_PASSWORD = os.getenv("MAIL_PASSWORD") + JWT_ACCESS_TOKEN_EXPIRES = 604800 + ALLOW_RESET = os.getenv("ALLOW_RESET") + EXTERNAL_URL = os.getenv("EXTERNAL_URL") + SANDBOX_API_URL = os.getenv("SANDBOX_API_URL") + GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY") + SHEET_ID = os.getenv("SHEET_ID") + MG_LIST = os.getenv("MG_LIST") + ANSWER_ATTEMPT_LIMIT = "5 per 1 minutes" + CODE_CHALLENGE_START = 1586703600