-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
If user is not logged in then send token by email to validate email
- Loading branch information
Showing
9 changed files
with
201 additions
and
39 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 |
---|---|---|
@@ -1,24 +1,39 @@ | ||
from django.apps import AppConfig | ||
from django.db.utils import OperationalError | ||
|
||
|
||
class MembersConfig(AppConfig): | ||
name = 'members' | ||
name = "members" | ||
|
||
def ready(self): | ||
from members.models.emailtemplate import EmailTemplate | ||
|
||
# Check if the NEW_VOLUNTEER email template exists, and create it if it does not | ||
# Check if email templates exists, and create them if they do not | ||
try: | ||
if not EmailTemplate.objects.filter(idname="NEW_VOLUNTEER").exists(): | ||
EmailTemplate.objects.create( | ||
idname="NEW_VOLUNTEER", | ||
name="Ny frivillig", | ||
description="Email template for nye frivillig forespørgsler", | ||
description="Ny frivillig forespørgsel", | ||
from_address="[email protected]", | ||
subject="Ny frivillig til Coding Pirates {{ department }}", | ||
body_html="<p>A new volunteer request has been made.</p><p>Details: {{ volunteer_request }}</p>", | ||
body_text="A new volunteer request has been made.\nDetails: {{ volunteer_request }}", | ||
body_html=""" | ||
<p>Se detaljer i medlemssystemet, under Admin</p>""", | ||
body_text=""" | ||
Se detaljer i medlemssystemet, under Admin""", | ||
) | ||
|
||
if not EmailTemplate.objects.filter(idname="SECURITY_TOKEN").exists(): | ||
EmailTemplate.objects.create( | ||
idname="SECURITY_TOKEN", | ||
name="Security Token", | ||
description="Sikkerhedskode", | ||
from_address="[email protected]", | ||
subject="Sikkerhedskode for Coding Pirates", | ||
body_html="<p>Din sikkerhedskode er: {{ token }}</p>", | ||
body_text="Din sikkerhedskode er: {{ token }}", | ||
) | ||
|
||
except OperationalError: | ||
# Handle the case where the database is not ready yet | ||
pass | ||
pass |
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
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.