working ish website
This commit is contained in:
parent
5540ac6d81
commit
b194d2031d
8 changed files with 271 additions and 6 deletions
71
statics/selfservice/index.html
Normal file
71
statics/selfservice/index.html
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Authentication Check</title>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
|
||||
<style>
|
||||
body {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
font-family: Arial, sans-serif;
|
||||
background-color: #f4f4f4;
|
||||
}
|
||||
.box {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 20px;
|
||||
background-color: white;
|
||||
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
#loginButton {
|
||||
margin-top: 20px;
|
||||
padding: 10px 20px;
|
||||
background-color: #007BFF;
|
||||
color: white;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
align-self: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="box">
|
||||
<h2 style="text-align: center;">SATITM<br/>Parent-Student Relationship<br/>Management</h2>
|
||||
<p id="subtitle">Please log in to continue</p>
|
||||
<a href="/selfservice/api/login" style="text-decoration: none;">
|
||||
<button id="loginButton">Login</button>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$.get('/selfservice/api/whoami')
|
||||
.done(function(response) {
|
||||
if (response.userType == 1) { //Student
|
||||
window.location.href = '/selfservice/student.html';
|
||||
} else if (response.userType == 2) { //Parent
|
||||
window.location.href = '/selfservice/parent.html';
|
||||
} else { // Unknown, change login button and change subtitle to "Your account is not allowed to access this service. Please log out."
|
||||
let loginButton = $('#loginButton');
|
||||
loginButton.text('Logout').on('click', function() {
|
||||
window.location.href = '/selfservice/api/logout';
|
||||
});
|
||||
// Make button red
|
||||
loginButton.css('background-color', 'red');
|
||||
$('#subtitle').text('Your account is not allowed to access this service. Please log out.');
|
||||
}
|
||||
|
||||
})
|
||||
.fail(function() {
|
||||
$('#loginButton').show().on('click', function() {
|
||||
window.location.href = '/selfservice/api/login';
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue