Added Repository
This commit is contained in:
47
static/js/login.js
Normal file
47
static/js/login.js
Normal file
@@ -0,0 +1,47 @@
|
||||
function togglePassword(inputId) {
|
||||
const input = document.getElementById(inputId);
|
||||
const button = event.target;
|
||||
|
||||
if (input.type === 'password') {
|
||||
input.type = 'text';
|
||||
button.textContent = '🙈';
|
||||
} else {
|
||||
input.type = 'password';
|
||||
button.textContent = '👁️';
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const form = document.querySelector('.auth-form');
|
||||
const emailInput = document.getElementById('email');
|
||||
const passwordInput = document.getElementById('password');
|
||||
|
||||
[emailInput, passwordInput].forEach(input => {
|
||||
input.addEventListener('focus', function () {
|
||||
this.parentElement.classList.add('focused');
|
||||
});
|
||||
|
||||
input.addEventListener('blur', function () {
|
||||
this.parentElement.classList.remove('focused');
|
||||
});
|
||||
});
|
||||
|
||||
form.addEventListener('submit', function (e) {
|
||||
const email = emailInput.value.trim();
|
||||
const password = passwordInput.value.trim();
|
||||
|
||||
if (!email || !password) {
|
||||
e.preventDefault();
|
||||
alert('Please fill in all fields');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!email.includes('@')) {
|
||||
e.preventDefault();
|
||||
alert('Please enter a valid email address');
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user