-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2358 from IFRCGo/feature/open-id
django-oauth-toolkit setup
- Loading branch information
Showing
16 changed files
with
892 additions
and
98 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 +1 @@ | ||
3.11.10 | ||
3.11 |
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,13 @@ | ||
from django.core import management | ||
from django.core.management.base import BaseCommand | ||
from sentry_sdk.crons import monitor | ||
|
||
from main.sentry import SentryMonitor | ||
|
||
|
||
class Command(BaseCommand): | ||
help = "A wrapper for cleartokens command to track using sentry cron monitor. Feel free to use cleartokens" | ||
|
||
@monitor(monitor_slug=SentryMonitor.OAUTH_CLEARTOKENS) | ||
def handle(self, *args, **kwargs): | ||
management.call_command("cleartokens") |
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,127 @@ | ||
{% load static %} | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>{% block title %}{% endblock title %}</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta name="description" content=""> | ||
<meta name="author" content=""> | ||
|
||
<link rel="preconnect" href="https://fonts.googleapis.com"> | ||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | ||
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap" rel="stylesheet"> | ||
{% block css %} | ||
{% endblock css %} | ||
|
||
<style> | ||
:root { | ||
font-family: 'Poppins', sans-serif; | ||
} | ||
body, html { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
h1, h2, h3, h4, h5, h6 { | ||
margin: 0; | ||
} | ||
p { | ||
margin: 0; | ||
} | ||
* { box-sizing: border-box } | ||
|
||
body { | ||
background-color: #f0f0f0; | ||
width: 100vw; | ||
height: 100vh; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
|
||
.container { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 1.5rem; | ||
align-items: center; | ||
justify-content: center; | ||
animation: slide-up .5s .3s ease-in forwards; | ||
opacity: 0; | ||
width: 100%; | ||
max-width: 30rem; | ||
} | ||
|
||
.block-center { | ||
width: 100%; | ||
background-color: #ffffff; | ||
padding: 1.5rem; | ||
border-radius: 0.5rem; | ||
box-shadow: 0 5px 3px -2px rgba(0, 0, 0, 0.2); | ||
} | ||
|
||
@keyframes slide-up { | ||
0% { | ||
opacity: 0; | ||
transform: translateY(10px); | ||
} | ||
|
||
100% { | ||
opacity: 1; | ||
transform: translateY(0); | ||
} | ||
} | ||
|
||
.block-center form { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 1rem; | ||
} | ||
|
||
ul { | ||
margin: 0; | ||
} | ||
|
||
button, | ||
input[type='submit'] { | ||
border: unset; | ||
line-height: 1; | ||
padding: 0.5rem 1rem; | ||
border-radius: 1.5rem; | ||
border: 1px solid rgba(0, 0, 0, 0.1); | ||
cursor: pointer; | ||
width: fit-content; | ||
} | ||
|
||
.btn-primary { | ||
background-color: #e04656; | ||
color: #fff; | ||
border-color: #e04656; | ||
} | ||
|
||
.control-group { | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: flex-end; | ||
} | ||
|
||
.control-group .controls { | ||
display: flex; | ||
gap: 0.5rem; | ||
} | ||
|
||
#go-logo { | ||
height: 3rem; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
|
||
<div class="container"> | ||
<img id="go-logo" alt="IFRC GO" src="{% static 'images/logo/go-logo-2020-6cdc2b0c.svg' %}" /> | ||
{% block content %} | ||
{% endblock content %} | ||
</div> | ||
</body> | ||
</html> |
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,71 @@ | ||
{% extends "oauth2_provider/base.html" %} | ||
{% block title %} | ||
IFRC GO | SSO Login | ||
{% endblock %} | ||
{% block css %} | ||
<style> | ||
form { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 1rem; | ||
width: 100%; | ||
} | ||
|
||
form > div { | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
form label { | ||
text-transform: capitalize; | ||
font-size: 0.875rem; | ||
} | ||
|
||
form input[type="password"], | ||
form input[type="text"] { | ||
border: unset; | ||
background-color: rgba(0, 0, 0, 0.1); | ||
padding: 0.5rem; | ||
border-radius: 0.25rem; | ||
} | ||
|
||
.block-center { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 1rem; | ||
} | ||
|
||
</style> | ||
{% endblock %} | ||
{% block content %} | ||
{% if request.user.is_authenticated %} | ||
<div class="block-center"> | ||
<h2>GO SSO</h2> | ||
<div>Hi {% firstof request.user.get_full_name request.user.username %}</div> | ||
{% if request.user.is_staff %} | ||
<a href="{% url "admin:index" %}">Admin panel</> | ||
{% endif %} | ||
<form method="post" action="{{ logout_url }}"> | ||
{% csrf_token %} | ||
<div class="control-group"> | ||
<button class='btn-primary' type="submit"> | ||
Logout | ||
</button> | ||
</div> | ||
</form> | ||
</div> | ||
{% else %} | ||
<div class="block-center"> | ||
<h2>GO SSO Login</h2> | ||
<form method="post"> | ||
{% csrf_token %} | ||
{{ form.as_div }} | ||
<div class="control-group"> | ||
<button class='btn-primary' type="submit"> | ||
Login | ||
</button> | ||
</div> | ||
</form> | ||
</div> | ||
{% endif %} | ||
{% endblock %} |
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.