mirror of
https://github.com/xfarrow/blink
synced 2025-06-27 09:03:02 +02:00
beautified
This commit is contained in:
@ -1,65 +1,71 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Log in - Blink</title>
|
||||
<link rel="stylesheet" href="../css/login-register.css">
|
||||
</head>
|
||||
<body>
|
||||
<!-- partial:index.partial.html -->
|
||||
<div id="login-form-wrap">
|
||||
<h2>Login</h2>
|
||||
<form id="login-form" method="POST">
|
||||
<html lang="en">
|
||||
|
||||
<p>
|
||||
<input type="email" id="email" name="email" placeholder="Email Address" required><i class="validation"><span></span><span></span></i>
|
||||
</p>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Log in - Blink</title>
|
||||
<link rel="stylesheet" href="../css/login-register.css">
|
||||
</head>
|
||||
|
||||
<p>
|
||||
<input type="password" id="password" name="password" placeholder="Password" required><i class="validation"><span></span><span></span></i>
|
||||
</p>
|
||||
<body>
|
||||
<!-- partial:index.partial.html -->
|
||||
<div id="login-form-wrap">
|
||||
<h2>Login</h2>
|
||||
<form id="login-form" method="POST">
|
||||
|
||||
<p>
|
||||
<input type="email" id="email" name="email" placeholder="Email Address" required><i
|
||||
class="validation"><span></span><span></span></i>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<input type="password" id="password" name="password" placeholder="Password" required><i
|
||||
class="validation"><span></span><span></span></i>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<button type="button" onclick="login()">Login</button>
|
||||
</p>
|
||||
</form>
|
||||
<div id="create-account-wrap">
|
||||
<p>Not a member? <a href="./register.html">Create Account</a>
|
||||
<p>
|
||||
<button type="button" onclick="login()">Login</button>
|
||||
</p>
|
||||
</form>
|
||||
<div id="create-account-wrap">
|
||||
<p>Not a member? <a href="./register.html">Create Account</a><p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="../js/constants.js"></script>
|
||||
<script>
|
||||
async function login() {
|
||||
const email = document.getElementById("email").value;
|
||||
const password = document.getElementById("password").value;
|
||||
<script src="../js/constants.js"></script>
|
||||
<script>
|
||||
async function login() {
|
||||
const email = document.getElementById("email").value;
|
||||
const password = document.getElementById("password").value;
|
||||
|
||||
if(!email || !password){
|
||||
alert('Please fill in all fields');
|
||||
return;
|
||||
}
|
||||
const response = await fetch(`${API_URL}/login`, {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
email: email,
|
||||
password: password }),
|
||||
headers: {
|
||||
"Content-type": "application/json; charset=UTF-8"
|
||||
}
|
||||
});
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
if(response.ok){
|
||||
console.log(`Login was successful. Token is ${data.token}`);
|
||||
document.cookie = `token=${data.token};`;
|
||||
window.location.href = 'userprofile.html?id=myself';
|
||||
}
|
||||
else{
|
||||
alert(data.error);
|
||||
}
|
||||
if (!email || !password) {
|
||||
alert('Please fill in all fields');
|
||||
return;
|
||||
}
|
||||
</script>
|
||||
const response = await fetch(`${API_URL}/login`, {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
email: email,
|
||||
password: password
|
||||
}),
|
||||
headers: {
|
||||
"Content-type": "application/json; charset=UTF-8"
|
||||
}
|
||||
});
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
if (response.ok) {
|
||||
console.log(`Login was successful. Token is ${data.token}`);
|
||||
document.cookie = `token=${data.token};`;
|
||||
window.location.href = 'userprofile.html?id=myself';
|
||||
} else {
|
||||
alert(data.error);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,11 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Title</title>
|
||||
<link rel="stylesheet" href="../css/organization.css">
|
||||
</head>
|
||||
|
||||
<body style="display: none;">
|
||||
<div class="container">
|
||||
<div class="hiring-badge" style="display: none;" id="isHiringBadge">Now Hiring</div>
|
||||
@ -26,50 +28,47 @@
|
||||
<script src="../js/utils.js"></script>
|
||||
|
||||
<script>
|
||||
window.addEventListener("load", async function() {
|
||||
window.addEventListener("load", async function () {
|
||||
loadOrganization();
|
||||
});
|
||||
|
||||
async function loadOrganization (){
|
||||
async function loadOrganization() {
|
||||
const idToDisplay = new URLSearchParams(window.location.search).get('id');
|
||||
if(!idToDisplay){
|
||||
if (!idToDisplay) {
|
||||
alert("Invalid URL.");
|
||||
return;
|
||||
}
|
||||
const response = await fetch(`${API_URL}/organization/${idToDisplay}`, {
|
||||
headers: {
|
||||
"Content-type": "application/json; charset=UTF-8",
|
||||
}
|
||||
headers: {
|
||||
"Content-type": "application/json; charset=UTF-8",
|
||||
}
|
||||
});
|
||||
const data = await response.json();
|
||||
if(response.ok) {
|
||||
if (response.ok) {
|
||||
populateFields(data.name, data.location, data.description, data.is_hiring);
|
||||
document.body.style.display = "block"; // Show page
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
alert(data.error);
|
||||
}
|
||||
}
|
||||
|
||||
function populateFields (name, location, description, isHiring) {
|
||||
function populateFields(name, location, description, isHiring) {
|
||||
document.getElementById('organizationName').textContent = name;
|
||||
document.title = `${name} - Blink`
|
||||
document.getElementById('location').textContent = location;
|
||||
document.getElementById('description').textContent = description;
|
||||
if(isHiring === true) {
|
||||
if (isHiring === true) {
|
||||
document.getElementById('isHiring').textContent = 'Yes';
|
||||
document.getElementById('isHiringBadge').style.display = 'block';
|
||||
}
|
||||
else if (isHiring === false) {
|
||||
} else if (isHiring === false) {
|
||||
document.getElementById('isHiring').textContent = 'No';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
document.getElementById('isHiring').textContent = 'Not specified';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
</html>
|
@ -1,76 +1,86 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Sign Up to Blink</title>
|
||||
<link rel="stylesheet" href="../css/login-register.css">
|
||||
<script src=""></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- partial:index.partial.html -->
|
||||
<div id="login-form-wrap">
|
||||
<h2>Sign Up</h2>
|
||||
<form id="login-form">
|
||||
<html lang="en">
|
||||
|
||||
<p>
|
||||
<input type="text" id="displayname" name="displayname" placeholder="Your name" required><i class="validation"><span></span><span></span></i>
|
||||
</p>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Sign Up to Blink</title>
|
||||
<link rel="stylesheet" href="../css/login-register.css">
|
||||
<script src=""></script>
|
||||
</head>
|
||||
|
||||
<p>
|
||||
<input type="email" id="email" name="email" placeholder="Email Address" required><i class="validation"><span></span><span></span></i>
|
||||
</p>
|
||||
<body>
|
||||
<!-- partial:index.partial.html -->
|
||||
<div id="login-form-wrap">
|
||||
<h2>Sign Up</h2>
|
||||
<form id="login-form">
|
||||
|
||||
<p>
|
||||
<input type="password" id="password" name="password" placeholder="Password" required><i class="validation"><span></span><span></span></i>
|
||||
</p>
|
||||
<p>
|
||||
<input type="text" id="displayname" name="displayname" placeholder="Your name" required><i
|
||||
class="validation"><span></span><span></span></i>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<button type="button" onclick="register()">Register</button>
|
||||
</p>
|
||||
</form>
|
||||
<div id="create-account-wrap">
|
||||
<p>Already a member? <a href="./login.html">Login</a><p>
|
||||
</div>
|
||||
</div>
|
||||
<p>
|
||||
<input type="email" id="email" name="email" placeholder="Email Address" required><i
|
||||
class="validation"><span></span><span></span></i>
|
||||
</p>
|
||||
|
||||
<script src="../js/constants.js"></script>
|
||||
<script src="../js/utils.js"></script>
|
||||
<p>
|
||||
<input type="password" id="password" name="password" placeholder="Password" required><i
|
||||
class="validation"><span></span><span></span></i>
|
||||
</p>
|
||||
|
||||
<script>
|
||||
<p>
|
||||
<button type="button" onclick="register()">Register</button>
|
||||
</p>
|
||||
</form>
|
||||
<div id="create-account-wrap">
|
||||
<p>Already a member? <a href="./login.html">Login</a>
|
||||
<p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
function register(){
|
||||
const display_name = document.getElementById('displayname').value;
|
||||
const email = document.getElementById('email').value;
|
||||
const password = document.getElementById('password').value;
|
||||
|
||||
if(!display_name || !email || !password){
|
||||
alert('Please fill in all fields');
|
||||
return;
|
||||
<script src="../js/constants.js"></script>
|
||||
<script src="../js/utils.js"></script>
|
||||
|
||||
<script>
|
||||
function register() {
|
||||
const display_name = document.getElementById('displayname').value;
|
||||
const email = document.getElementById('email').value;
|
||||
const password = document.getElementById('password').value;
|
||||
|
||||
if (!display_name || !email || !password) {
|
||||
alert('Please fill in all fields');
|
||||
return;
|
||||
}
|
||||
|
||||
const options = {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
display_name,
|
||||
email,
|
||||
password
|
||||
}),
|
||||
};
|
||||
|
||||
fetch(`${API_URL}/register`, options)
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
alert("Congratulations! You've successfully registered to Blink." +
|
||||
" Please click on the e-mail we sent you to confirm your account");
|
||||
|
||||
window.location.href = '/login.html';
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
alert("An error has occurred :-( please try again later")
|
||||
console.error(err);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
const options = {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({ display_name, email, password }),
|
||||
};
|
||||
</body>
|
||||
|
||||
fetch(`${API_URL}/register`, options)
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
alert("Congratulations! You've successfully registered to Blink." +
|
||||
" Please click on the e-mail we sent you to confirm your account");
|
||||
|
||||
window.location.href = '/login.html';
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
alert("An error has occurred :-( please try again later")
|
||||
console.error(err);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
@ -1,11 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Page Title</title>
|
||||
<link rel="stylesheet" href="../css/profile.css">
|
||||
</head>
|
||||
|
||||
<body style="display: none;">
|
||||
<div class="container">
|
||||
<div class="edit-badge" style="display: none;" id="editBadge" onclick="editProfile()">Edit</div>
|
||||
@ -46,21 +48,21 @@
|
||||
<script src="../js/utils.js"></script>
|
||||
|
||||
<script>
|
||||
window.addEventListener("load", async function() {
|
||||
window.addEventListener("load", async function () {
|
||||
loadProfile();
|
||||
});
|
||||
|
||||
async function loadProfile (){
|
||||
|
||||
async function loadProfile() {
|
||||
|
||||
const idToDisplay = new URLSearchParams(window.location.search).get('id');
|
||||
let response;
|
||||
|
||||
// Retrieving the logged in user's profile
|
||||
if(!idToDisplay || idToDisplay === 'myself'){
|
||||
if (!idToDisplay || idToDisplay === 'myself') {
|
||||
document.getElementById('editBadge').style.display = 'block'; // show edit button
|
||||
const token = getCookie('token');
|
||||
// Check whether the token exists
|
||||
if(!token){
|
||||
if (!token) {
|
||||
window.location.href = 'login.html';
|
||||
}
|
||||
response = await fetch(`${API_URL}/person/myself`, {
|
||||
@ -69,8 +71,7 @@
|
||||
"authorization": token
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
response = await fetch(`${API_URL}/person/${idToDisplay}/details`, {
|
||||
headers: {
|
||||
"Content-type": "application/json; charset=UTF-8",
|
||||
@ -79,19 +80,17 @@
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
if (response.ok){
|
||||
if (response.ok) {
|
||||
populateFields(data.display_name, data.email, data.about_me, data.qualification);
|
||||
document.body.style.display = 'block'; // Show page
|
||||
}
|
||||
else if (response.status == 401){
|
||||
} else if (response.status == 401) {
|
||||
window.location.href = 'login.html';
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
alert(`Unable to load profile. Error: ${data.error}`);
|
||||
}
|
||||
}
|
||||
|
||||
function populateFields (displayName, email, aboutMe, qualification) {
|
||||
function populateFields(displayName, email, aboutMe, qualification) {
|
||||
document.getElementById('displayName').textContent = displayName;
|
||||
document.title = `${displayName} - Blink`
|
||||
document.getElementById('email').textContent = email;
|
||||
@ -99,12 +98,11 @@
|
||||
document.getElementById('qualification').textContent = qualification;
|
||||
}
|
||||
|
||||
function editProfile () {
|
||||
function editProfile() {
|
||||
alert('Editing');
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
</html>
|
Reference in New Issue
Block a user