-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new dependencies and email templates
Update database initialization and security configuration Fix import statement in application.py Add new email templates for test email and new account Update security configuration for access token and secret key Add new email template for password recovery Update login endpoint to use async function for password recovery Update reset_password endpoint to use get_by_email function
- Loading branch information
Showing
14 changed files
with
238 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ class Settings(BaseSettings): | |
with environment variables. | ||
""" | ||
|
||
PROJECT_NAME: str = "BeMore" | ||
API_STR: str = "/api" | ||
SECRET_KEY: str = secrets.token_urlsafe(32) | ||
host: str = "127.0.0.1" | ||
|
@@ -36,15 +37,30 @@ class Settings(BaseSettings): | |
|
||
log_level: LogLevel = LogLevel.INFO | ||
|
||
SQLALCHEMY_DATABASE_URI: str = "sqlite:///./bemore.db" | ||
FIRST_SUPERUSER: str = "[email protected]" | ||
FIRST_SUPERUSER_PASSWORD: str = "admin" | ||
# 60 minutes * 24 hours * 8 days = 8 days | ||
ACCESS_TOKEN_EXPIRE_MINUTES: int = 60 * 24 * 8 | ||
|
||
EMAILS_ENABLED: bool = False | ||
EMAILS_FROM_NAME: str = "BeMore" | ||
EMAILS_FROM_EMAIL: str = "" | ||
EMAIL_RESET_TOKEN_EXPIRE_HOURS: int = 48 | ||
|
||
SMTP_HOST: str = "" | ||
SMTP_PORT: int = 0 | ||
SMTP_TLS: bool = True | ||
SMTP_USER: str = "" | ||
SMTP_PASSWORD: str = "" | ||
|
||
EMAIL_TEMPLATES_DIR: str = "bemore/email-templates/build" | ||
|
||
model_config = SettingsConfigDict( | ||
env_file=".env", | ||
env_prefix="BEMORE_", | ||
env_file_encoding="utf-8", | ||
) | ||
|
||
SQLALCHEMY_DATABASE_URI: str = "sqlite:///./bemore.db" | ||
FIRST_SUPERUSER: str = "admin@localhost" | ||
FIRST_SUPERUSER_PASSWORD: str = "admin" | ||
|
||
|
||
settings = Settings() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<mjml> | ||
<mj-body background-color="#fff"> | ||
<mj-section> | ||
<mj-column> | ||
<mj-divider border-color="#555"></mj-divider> | ||
<mj-text font-size="20px" color="#555" font-family="helvetica">{{ project_name }} - New Account</mj-text> | ||
<mj-text font-size="16px" color="#555">You have a new account:</mj-text> | ||
<mj-text font-size="16px" color="#555">Username: {{ username }}</mj-text> | ||
<mj-text font-size="16px" color="#555">Password: {{ password }}</mj-text> | ||
<mj-button padding="50px 0px" href="{{ link }}">Go to Dashboard</mj-button> | ||
<mj-divider border-color="#555" border-width="2px"></mj-divider> | ||
</mj-column> | ||
</mj-section> | ||
</mj-body> | ||
</mjml> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<mjml> | ||
<mj-body background-color="#fff"> | ||
<mj-section> | ||
<mj-column> | ||
<mj-divider border-color="#555"></mj-divider> | ||
<mj-text font-size="20px" color="#555" font-family="helvetica">{{ project_name }} - Password Recovery</mj-text> | ||
<mj-text font-size="16px" color="#555">We received a request to recover the password for user {{ username }} | ||
with email {{ email }}</mj-text> | ||
<mj-text font-size="16px" color="#555">Reset your password by clicking the button below:</mj-text> | ||
<mj-button padding="50px 0px" href="{{ link }}">Reset Password</mj-button> | ||
<mj-text font-size="16px" color="#555">Or open the following link:</mj-text> | ||
<mj-text font-size="16px" color="#555"><a href="{{ link }}">{{ link }}</a></mj-text> | ||
<mj-divider border-color="#555" border-width="2px"></mj-divider> | ||
<mj-text font-size="14px" color="#555">The reset password link / button will expire in {{ valid_hours }} hours.</mj-text> | ||
<mj-text font-size="14px" color="#555">If you didn't request a password recovery you can disregard this email.</mj-text> | ||
</mj-column> | ||
</mj-section> | ||
</mj-body> | ||
</mjml> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<mjml> | ||
<mj-body background-color="#fff"> | ||
<mj-section> | ||
<mj-column> | ||
<mj-divider border-color="#555"></mj-divider> | ||
<mj-text font-size="20px" color="#555" font-family="helvetica">{{ project_name }}</mj-text> | ||
<mj-text font-size="16px" color="#555">Test email for: {{ email }}</mj-text> | ||
</mj-column> | ||
</mj-section> | ||
</mj-body> | ||
</mjml> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.