Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified Menthub/__pycache__/app.cpython-313.pyc
Binary file not shown.
Binary file modified Menthub/__pycache__/models.cpython-313.pyc
Binary file not shown.
31 changes: 31 additions & 0 deletions Menthub/static/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
let currentUser = null
let mentors = []
let mentorshipRequests = []
let passwordToggleInitialized = false

// Sample data for demonstration
const sampleMentors = [
Expand Down Expand Up @@ -129,6 +130,7 @@ document.addEventListener("DOMContentLoaded", () => {
initializeApp()
setupEventListeners()
loadSampleData()
setupPasswordToggles()
})

function initializeApp() {
Expand Down Expand Up @@ -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) {
Expand All @@ -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")
Expand All @@ -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) {
Expand Down
61 changes: 61 additions & 0 deletions Menthub/static/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 */
Expand Down
4 changes: 4 additions & 0 deletions Menthub/templates/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FLASK_APP=app.py
FLASK_ENV=development
DATABASE_URL=postgresql://postgres:root@localhost/menthub_db

10 changes: 8 additions & 2 deletions Menthub/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ <h1><i class="fas fa-graduation-cap"></i> MentorConnect</h1>
</div>
<div class="form-group">
<label for="loginPassword">Password</label>
<input type="password" id="loginPassword" name="password" required>
<div class="password-container">
<input type="password" id="loginPassword" name="password" required>
<span class="toggle-password"><i class="fas fa-eye"></i></span>
</div>
</div>
<button type="submit" class="btn btn-primary">Login</button>
</form>
Expand All @@ -77,7 +80,10 @@ <h1><i class="fas fa-graduation-cap"></i> MentorConnect</h1>

<div class="form-group">
<label for="signupPassword">Password</label>
<input type="password" id="signupPassword" name="password" required>
<div class="password-container">
<input type="password" id="signupPassword" name="password" required>
<span class="toggle-password"><i class="fas fa-eye"></i></span>
</div>
</div>

<div class="form-row">
Expand Down