-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use the `GOOGLE_SSO_ENABLE_LOGS` to enable/disable logs. Logs now will show all info send to django messages. Use the `GOOGLE_SSO_ENABLE_MESSAGES` to enable/disable django messages.
- Loading branch information
1 parent
c2fcf59
commit c718030
Showing
6 changed files
with
57 additions
and
12 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
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 @@ | ||
from django.contrib import messages | ||
from loguru import logger | ||
|
||
from django_google_sso import conf | ||
|
||
|
||
def send_message(request, message, level: str = "error"): | ||
getattr(logger, level.lower())(message) | ||
if conf.GOOGLE_SSO_ENABLE_MESSAGES: | ||
messages.add_message(request, getattr(messages, level.upper()), message) | ||
|
||
|
||
def show_credential(credential): | ||
credential = str(credential) | ||
return f"{credential[:5]}...{credential[-5:]}" |
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