diff --git a/Menthub/__pycache__/app.cpython-313.pyc b/Menthub/__pycache__/app.cpython-313.pyc index a2400a3..bf76ce3 100644 Binary files a/Menthub/__pycache__/app.cpython-313.pyc and b/Menthub/__pycache__/app.cpython-313.pyc differ diff --git a/Menthub/__pycache__/models.cpython-313.pyc b/Menthub/__pycache__/models.cpython-313.pyc index fee525e..0ad655e 100644 Binary files a/Menthub/__pycache__/models.cpython-313.pyc and b/Menthub/__pycache__/models.cpython-313.pyc differ diff --git a/Menthub/static/script.js b/Menthub/static/script.js index b351712..5833204 100644 --- a/Menthub/static/script.js +++ b/Menthub/static/script.js @@ -2,6 +2,7 @@ let currentUser = null let mentors = [] let mentorshipRequests = [] +let passwordToggleInitialized = false // Sample data for demonstration const sampleMentors = [ @@ -129,6 +130,7 @@ document.addEventListener("DOMContentLoaded", () => { initializeApp() setupEventListeners() loadSampleData() + setupPasswordToggles() }) function initializeApp() { @@ -173,6 +175,8 @@ function setupEventListeners() { // Availability toggle document.getElementById("availabilityToggle").addEventListener("change", toggleAvailability) + // Password toggle handled by a single delegated listener; no per-tab setup needed + // Close modal when clicking outside document.getElementById("requestModal").addEventListener("click", function (e) { if (e.target === this) { @@ -181,6 +185,31 @@ function setupEventListeners() { }) } +function setupPasswordToggles() { + if (passwordToggleInitialized) return + passwordToggleInitialized = true + + // One-time delegated listener works for both login and signup tabs + document.addEventListener('click', function (e) { + const toggle = e.target.closest('.toggle-password') + if (!toggle) return + + e.preventDefault() + e.stopPropagation() + + const container = toggle.closest('.password-container') + const passwordInput = container ? container.querySelector('input[type="password"], input[type="text"]') : null + const icon = toggle.querySelector('i') + + if (!passwordInput || !icon) return + + const toText = passwordInput.type === 'password' + passwordInput.type = toText ? 'text' : 'password' + icon.classList.toggle('fa-eye', !toText) + icon.classList.toggle('fa-eye-slash', toText) + }) +} + function switchAuthTab(tab) { const loginTab = document.getElementById("loginTab") const signupTab = document.getElementById("signupTab") @@ -198,6 +227,8 @@ function switchAuthTab(tab) { signupForm.classList.add("active") loginForm.classList.remove("active") } + + // No need to re-initialize password toggles; listener is delegated and initialized once } function handleLogin(e) { diff --git a/Menthub/static/styles.css b/Menthub/static/styles.css index ee28eda..eee0790 100644 --- a/Menthub/static/styles.css +++ b/Menthub/static/styles.css @@ -184,6 +184,53 @@ body { box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1); } +/* Password Toggle Styles */ +.password-container { + position: relative; +} + +.toggle-password { + position: absolute; + right: 12px; + top: 58%; + transform: translateY(-15%); + cursor: pointer; + color: #666; + transition: color 0.3s ease; + z-index: 10; + display: flex; + align-items: center; + justify-content: center; + width: 24px; + height: 24px; + border-radius: 50%; + background: rgba(255, 255, 255, 0.9); + border: 1px solid rgba(102, 126, 234, 0.2); +} + +.toggle-password:hover { + color: #667eea; + background: rgba(102, 126, 234, 0.1); +} + +.toggle-password i { + font-size: 14px; + line-height: 1; + display: flex; + align-items: center; + justify-content: center; + width: 100%; + height: 100%; +} + +.password-container input[type="password"] { + padding-right: 45px; +} + +.password-container input[type="text"] { + padding-right: 45px; +} + .radio-group, .checkbox-group { display: flex; @@ -833,6 +880,20 @@ input[type="checkbox"] { .search-bar input { padding: 14px 14px 14px 45px; } + + .toggle-password { + width: 28px; + height: 28px; + } + + .toggle-password i { + font-size: 16px; + } + + .password-container input[type="password"], + .password-container input[type="text"] { + padding-right: 50px; + } } /* Loading States */ diff --git a/Menthub/templates/.env b/Menthub/templates/.env new file mode 100644 index 0000000..699ed24 --- /dev/null +++ b/Menthub/templates/.env @@ -0,0 +1,4 @@ +FLASK_APP=app.py +FLASK_ENV=development +DATABASE_URL=postgresql://postgres:root@localhost/menthub_db + diff --git a/Menthub/templates/index.html b/Menthub/templates/index.html index 3a71026..6ba192a 100644 --- a/Menthub/templates/index.html +++ b/Menthub/templates/index.html @@ -55,7 +55,10 @@