Skip to content

Commit

Permalink
Login Redirection enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
NuwanJ-RhinoPartners committed Jul 30, 2023
1 parent 395c039 commit 5354d27
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 39 deletions.
70 changes: 47 additions & 23 deletions assets/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,38 @@ h1, h2, h3, h4, h5, h6
}
*/

h2{
padding-top: 12px;
padding-bottom: 6px;
margin-bottom: 18px;
h2 {
padding-top: 12px;
padding-bottom: 6px;
margin-bottom: 18px;
}

.text-link:hover{
color: #006f9e!important;
text-decoration: underline!important;
.text-link:hover {
color: #006f9e !important;
text-decoration: underline !important;
}

.vh-50{
min-height: 50vh!important;
.vh-50 {
min-height: 50vh !important;
}
.vh-75{
min-height: 75vh!important;

.vh-75 {
min-height: 75vh !important;
}

.display-4 {
font-size: 2.5rem;
}

@media (min-width: 768px) {
.display-4 {
font-size: 3rem;
}
}

.navbar-dark{
/* background-color: #343a40!important; */
/* background-color: #4b5863 !important; */
.navbar-dark {
/* background-color: #343a40!important; */
/* background-color: #4b5863 !important; */
}

.nav-scroller {
Expand Down Expand Up @@ -76,15 +78,27 @@ h2{
flex: 0 0 auto;
}

.h-250 { height: 250px; }
.h-250 {
height: 250px;
}

@media (min-width: 768px) {
.h-md-250 { height: 250px; }
.h-md-250 {
height: 250px;
}
}

.border-top {
border-top: 1px solid #e5e5e5;
}

.border-top { border-top: 1px solid #e5e5e5; }
.border-bottom { border-bottom: 1px solid #e5e5e5; }
.border-bottom {
border-bottom: 1px solid #e5e5e5;
}

.box-shadow { box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05); }
.box-shadow {
box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
}

/*
* Blog name and description
Expand All @@ -94,6 +108,7 @@ h2{
font-size: 2rem;
font-weight: 400;
}

.blog-description {
font-size: 1.1rem;
color: #999;
Expand All @@ -109,7 +124,8 @@ h2{
.blog-pagination {
margin-bottom: 4rem;
}
.blog-pagination > .btn {

.blog-pagination>.btn {
border-radius: 2rem;
}

Expand All @@ -119,10 +135,12 @@ h2{
.blog-post {
margin-bottom: 4rem;
}

.blog-post-title {
margin-bottom: 1rem;
font-size: 2.0rem;
}

.blog-post-meta {
margin-bottom: 1.25rem;
color: #999;
Expand All @@ -138,12 +156,18 @@ h2{
background-color: #f9f9f9;
border-top: .05rem solid #e5e5e5;
}

.blog-footer p:last-child {
margin-bottom: 0;
}


.project-btn{
min-width: 150px!important;
float: right;
.project-btn {
min-width: 150px !important;
float: right;
}


.btn-200 {
min-width: 200px;
}
29 changes: 13 additions & 16 deletions pages/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ <h5 class="card-title">Settings</h5>
placeholder="Password of the MQTT broker" value="">
</div>
<div class="">
<button id="btnGenerate" type="button" class="btn btn-primary m-auto">Generate Access
Links</button>
<button id="btnGenerate" type="button" class="btn btn-primary m-auto btn-200"></button>
</div>
</div>
</div>
Expand All @@ -76,14 +75,6 @@ <h5 class="access-link d-none">Access Links:</h5>
</a>
</div>
</div>

<div class="card rd-link d-none">
<div class="card-body">Click here to access<br>
<a id="linkRD" href="#" target="_blank" class="card-link">
#
</a>
</div>
</div>
</div>
</div>
</div>
Expand All @@ -92,6 +83,15 @@ <h5 class="access-link d-none">Access Links:</h5>
<script type="text/javascript" async>
$(document).ready(function () {

// Is there a rd component in the URL ? Then generate the link for it
const params = new URLSearchParams(location.search);
const rdURL = params.get('rd');
if (rdURL != undefined) {
$('#btnGenerate').text("Login");
} else {
$('#btnGenerate').text("Generate Token");
}

$('#btnGenerate').click(() => {
const endpoint = 'https://webservices.ceykod.com/pera-swarm/login/';

Expand Down Expand Up @@ -123,14 +123,11 @@ <h5 class="access-link d-none">Access Links:</h5>
if (resp.status == "Success") {
console.log(resp)
const token = resp.token;
// Is there a rd component in the URL ? Then generate the link for it
const params = new URLSearchParams(location.search);
const rdURL = params.get('rd')

if (rdURL != undefined) {
const url = `${rdURL}/?key=${token}`;
$('.rd-link').removeClass('d-none');
$('#linkRD').attr('href', url);
$('#linkRD').html(rdURL);
console.log("Redirecting to ", url)
window.location.replace(url);
} else {
const link3D = `https://pera-swarm.ce.pdn.ac.lk/visualizer/?key=${token}`;
const linkAR = `https://pera-swarm.ce.pdn.ac.lk/visualizer-ar/?key=${token}`;
Expand Down

0 comments on commit 5354d27

Please sign in to comment.