Skip to content

Commit

Permalink
integrated with svv api
Browse files Browse the repository at this point in the history
  • Loading branch information
Aatmaj-Zephyr committed Dec 11, 2023
1 parent 2d0ad2b commit 35cff04
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 75 deletions.
23 changes: 23 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"workbench.colorCustomizations": {
"activityBar.activeBackground": "#87f0a9",
"activityBar.background": "#87f0a9",
"activityBar.foreground": "#15202b",
"activityBar.inactiveForeground": "#15202b99",
"activityBarBadge.background": "#9971ed",
"activityBarBadge.foreground": "#15202b",
"commandCenter.border": "#15202b99",
"sash.hoverBorder": "#87f0a9",
"statusBar.background": "#5aea89",
"statusBar.foreground": "#15202b",
"statusBarItem.hoverBackground": "#2de469",
"statusBarItem.remoteBackground": "#5aea89",
"statusBarItem.remoteForeground": "#15202b",
"titleBar.activeBackground": "#5aea89",
"titleBar.activeForeground": "#15202b",
"titleBar.inactiveBackground": "#5aea8999",
"titleBar.inactiveForeground": "#15202b99"
},
"peacock.color": "#5aea89",
"liveServer.settings.port": 5501
}
49 changes: 42 additions & 7 deletions auth.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


</head>
<body clas="screen">
<body class="screen">

<div class="redMat">
<div class="darkRed"></div>
Expand Down Expand Up @@ -42,7 +42,26 @@
<script>


async function check_username_psw(username, password) {
console.log("hi");
var url = "https://myaccount.somaiya.edu/api/api/auth/GetMemberWInstProgrammes?SVVNetID=" + username + "&password=" + password + "&socialLogin=N"; // Replace with your API endpoint
console.log(url)
try {
const response = await fetch(url);

if (!response.ok) {
throw new Error("Network response was not ok");
}

const data = await response.json();
console.log(data);
return data;
} catch (error) {
console.log("There was a problem with the fetch operation:", error);

throw error;
}
}

function Login(){
console.log("click");
Expand All @@ -52,12 +71,28 @@

//check username and password validity

//if valid then go to generate page.
localStorage.setItem("Authenticated", "Partial");
localStorage.setItem("mail",username+"@somaiya.edu");
window.location.href = "./twoFactorAuth.html"; //redirect to two factor auth page
//if two factor authentication performed for the first time then go to generate page
//localStorage.setItem("Authenticated", "true");


check_username_psw(username, password)
.then(data => {
if(data.status=="FAIL"){
window.alert("Incorrect username or password")
}
else{
data = JSON.stringify(data);
localStorage.setItem("Data",data)

//if valid then go to generate page.
localStorage.setItem("Authenticated", "Partial");
localStorage.setItem("mail",username+"@somaiya.edu");
window.location.href = "./twoFactorAuth.html"; //redirect to two factor auth page
//if two factor authentication performed for the first time then go to generate page
//localStorage.setItem("Authenticated", "true");
}})
.catch(error => {
window.alert("Please check your net connection");
});


}

Expand Down
82 changes: 25 additions & 57 deletions id.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
</div>

<div class="IDtransparentframe">
<div class="clgText">K.J. Somaiya College of Engineering</div>
<div id="college" class="clgText">K.J. Somaiya College of Engineering</div>
</div>
<div id="name" class="name"> abcdefgh</div>
<div id="IDnum" class="IDNo">ID No: 1234</div>
<div id="bloodGroup" class="bloodGroup">Blood Group: Z+</div>
<div id="telephone" class="tel">Tel:999999999</div>
<div id="program" class="bloodGroup">Program: Z+</div>
<div id="telephone" class="tel">Enrollment Date:999999999</div>
<img
class="somaiyaTrust"
src="https://www.somaiya.edu//assets/arigel_general/img/homepage/Trust.svg"
Expand Down Expand Up @@ -101,65 +101,33 @@
};
</script>
<script>
initializeWithDefaultCache();
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
const firebaseConfig = {
apiKey: "AIzaSyBCm5eIm3Eh0TbLqotNgsX9m3AjW_ZUCNg",
authDomain: "wpl-mini-project.firebaseapp.com",
databaseURL: "https://wpl-mini-project-default-rtdb.firebaseio.com",
projectId: "wpl-mini-project",
storageBucket: "wpl-mini-project.appspot.com",
messagingSenderId: "696331304474",
appId: "1:696331304474:web:837b7598baf25502679ba3",
measurementId: "G-6HN1C9SXMF"
};
firebase.initializeApp(firebaseConfig);
console.log(firebase);
var id=111111;
var name="abcd";
var phone="9978890";
var bg="Z-";

//do in php
//iterate over firebase database
for(let num=0;num<=201;num++){
var db = firebase.database().ref('/' + num);

db.once('value', (snapshot) => { //change monitored only once.
if(localStorage.getItem("mail")==snapshot.val().mail){
console.log("user found")
id=snapshot.val().Rollno
name= snapshot.val().MName +" "+snapshot.val().fatherName.charAt(0) +" "+snapshot.val().Surname;
phone = snapshot.val().Tel;
bg = snapshot.val().bloodgrp;
document.getElementById("image").src="https://myaccount.somaiya.edu/images/ID/"+id+".jpg";
document.getElementById("signature").src="https://myaccount.somaiya.edu/images/Signature/S"+id+".png";


console.log("user found")
data = localStorage.getItem("Data");
data = JSON.parse(data)[0];
console.log(JSON.stringify(data))
id=data.member_Id
console.log(id)
name= data.student_Name;
phone = data.enrollment_Date;
program = data.course_Name;
college = data.inst_Name
document.getElementById("image").src="https://myaccount.somaiya.edu/images/ID/"+id+".jpg";
document.getElementById("signature").src="https://myaccount.somaiya.edu/images/Signature/S"+id+".png";

document.getElementById("IDnum").innerHTML="ID No: "+id;
localStorage.setItem("IDnum",id);

document.getElementById("name").innerHTML=name;
localStorage.setItem("name",name);
document.getElementById("bloodGroup").innerHTML="Blood Group: "+bg;
localStorage.setItem("bg",bg);
document.getElementById("telephone").innerHTML="Tel:"+phone;
localStorage.setItem("phone",phone);

document.getElementById("program").innerHTML="Program: "+program;

document.getElementById("college").innerHTML=college;

document.getElementById("telephone").innerHTML="Enrollment Date:"+phone;

var qrcode = new QRCode("qrcode", ""+id);

}

});
}

function initializeWithDefaultCache(){
document.getElementById("IDnum").innerHTML=localStorage.getItem("IDnum");
document.getElementById("name").innerHTML=localStorage.getItem("name");
document.getElementById("bloodGroup").innerHTML=localStorage.getItem("bg");
document.getElementById("telephone").innerHTML=localStorage.getItem("phone");
document.getElementById("image").src="https://myaccount.somaiya.edu/images/ID/"+localStorage.getItem("IDnum")+".jpg";
document.getElementById("signature").src="https://myaccount.somaiya.edu/images/Signature/S"+localStorage.getItem("IDnum")+".png";


}

/**************SAFETY*********/
//prevent inspect by refreshing after every few seconds
Expand Down
22 changes: 11 additions & 11 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@
position: absolute;
width: 100%;
height: 28px;
right: 15%;
right: 10%;
top: 67%;

font-family: "Bahnschrift ";
Expand All @@ -296,14 +296,14 @@

position: absolute;

height: 18px;
height: 10px;
left: 5%;
top: 74%;
top: 70%;

font-family: "Bahnschrift ";
font-style: normal;
font-weight: 400;
font-size: 35px;
font-size: 25px;
line-height: 35px;
/* identical to box height */

Expand All @@ -315,14 +315,14 @@
/* Blood Group: O+ */

position: absolute;
height: 18px;
height: 10px;
left: 5%;
top: 78%;
top: 72.5%;

font-family: "Bahnschrift ";
font-style: normal;
font-weight: 400;
font-size: 35px;
font-size: 25px;
line-height: 35px;
/* identical to box height */

Expand All @@ -334,14 +334,14 @@
/* Tel: 9820775339 */

position: absolute;
height: 18px;
right: 5%;
top: 74%;
height: 10px;
left: 5%;
top: 75%;

font-family: "Bahnschrift ";
font-style: normal;
font-weight: 400;
font-size: 35px;
font-size: 25px;
line-height: 35px;
/* identical to box height */

Expand Down

0 comments on commit 35cff04

Please sign in to comment.