Merge branch 'development' of github.com:Rushilwiz/SkoolOS into development

This commit is contained in:
Nathaniel Kenschaft 2020-06-14 16:58:16 -04:00
commit 1ba3d791f3
3 changed files with 13 additions and 2 deletions

1
.profile Normal file
View File

@ -0,0 +1 @@
{'absences': 2, 'address': None, 'counselor': {'first_name': 'Sean', 'full_name': 'Sean Burke', 'id': 37, 'last_name': 'Burke', 'url': 'https://ion.tjhsst.edu/api/profile/37', 'user_type': 'counselor', 'username': 'SPBurke'}, 'display_name': 'Raffu Khondaker', 'emails': [], 'first_name': 'Raffu', 'full_name': 'Raffu Khondaker', 'grade': {'name': 'sophomore', 'number': 10}, 'graduation_year': 2022, 'id': 36508, 'ion_username': '2022rkhondak', 'is_announcements_admin': False, 'is_eighth_admin': False, 'is_student': True, 'is_teacher': False, 'last_name': 'Khondaker', 'middle_name': 'Al', 'nickname': '', 'phones': [], 'picture': 'https://ion.tjhsst.edu/api/profile/36508/picture', 'sex': 'Male', 'short_name': 'Raffu', 'title': None, 'tj_email': '2022rkhondak@tjhsst.edu', 'user_type': 'student', 'websites': []}

View File

@ -14,7 +14,7 @@
</head>
<body>
<div class="d-flex align-items-center justify-content-center" style="height: 100vh">
<a href="https://ion.tjhsst.edu/oauth/authorize/?response_type=code&client_id=QeZPBSKqdvWFfBv1VYTSv9iFGz5T9pVJtNUjbEr6&redirect_uri=http%3A%2F%2Flocalhost%3A8000%2F&scope=read&state=O9QWIinWimSA8Kehr8vxUZHZ0SNPpL" title="Ion" class="border border-dark p-3 btn btn-lg mx-auto" style="box-shadow: 5px 10px;">
<img src="https://ion.tjhsst.edu/static/img/favicon.png">
Sign in with Ion
</a>

View File

@ -14,6 +14,7 @@ from PyInquirer import prompt, print_json
import json
import os
import argparse
from cryptography.fernet import Fernet
client_id = r'QeZPBSKqdvWFfBv1VYTSv9iFGz5T9pVJtNUjbEr6'
client_secret = r'0Wl3hAIGY9SvYOqTOLUiLNYa4OlCgZYdno9ZbcgCT7RGQ8x2f1l2HzZHsQ7ijC74A0mrOhhCVeZugqAmOADHIv5fHxaa7GqFNtQr11HX9ySTw3DscKsphCVi5P71mlGY'
@ -69,6 +70,11 @@ def authenticate():
browser.get("localhost:8000/")
while "http://localhost:8000/callback/?code" not in browser.current_url:
time.sleep(0.25)
url = browser.current_url
gets = url_decode(url.replace("http://localhost:8000/callback/?", ""))
while "http://localhost:8000/callback/?code" not in browser.current_url:
time.sleep(0.25)
@ -101,6 +107,10 @@ def authenticate():
os.chdir(cdir)
profileFile = open(".profile", "w")
#profileFile.write(profile.text())
key = Fernet.generate_key()
file = open('key.key', 'wb')
file.write(key) # The key is type bytes still
file.close()
profileFile.write(str(profile))
profileFile.close()