Skip to content
Merged
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
9 changes: 7 additions & 2 deletions client/user/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,13 @@
</div>
<div class="col-12 mb-3">
<label class="form-label" for="password">Password</label>
<input class="form-control" id="password" type="password" name="password" required>
<div class="invalid-feedback">Enter your password.</div>
<div class="input-group">
<input class="form-control" id="password" type="password" name="password" required>
<button class="btn btn-outline-secondary" id="toggle-password" type="button" aria-label="Show password">
<i class="bi bi-eye"></i>
</button>
<div class="invalid-feedback">Enter your password.</div>
</div>
<div class="form-text" id="passwordHelp">Forgot your password? <a href="/user/forgot-password">Click here</a>.</div>
</div>
<button class="btn btn-primary" id="submission" type="submit">
Expand Down
10 changes: 10 additions & 0 deletions client/user/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@ import account from '../scripts/accounts.js';

account.deleteUsername();

const passwordInput = document.getElementById('password');
const togglePassword = document.getElementById('toggle-password');
togglePassword.addEventListener('click', () => {
const isPassword = passwordInput.type === 'password';
passwordInput.type = isPassword ? 'text' : 'password';
togglePassword.querySelector('i').classList.toggle('bi-eye', !isPassword);
togglePassword.querySelector('i').classList.toggle('bi-eye-slash', isPassword);
togglePassword.setAttribute('aria-label', isPassword ? 'Hide password' : 'Show password');
});

const form = document.getElementById('login-form');
form.addEventListener('submit', (event) => {
event.preventDefault();
Expand Down
9 changes: 7 additions & 2 deletions client/user/signup.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@
<div class="row mb-3">
<div class="col-12">
<label class="form-label" for="password">Password</label>
<input class="form-control" id="password" type="password" name="password" required>
<div class="invalid-feedback">Enter your password.</div>
<div class="input-group">
<input class="form-control" id="password" type="password" name="password" required>
<button class="btn btn-outline-secondary" id="toggle-password" type="button" aria-label="Show password">
<i class="bi bi-eye"></i>
</button>
<div class="invalid-feedback">Enter your password.</div>
</div>
<div class="form-text">
By signing up, you agree to the <a href="/about/privacy-policy">privacy policy</a> and <a
href="/about/terms-of-service">terms of service</a>.
Expand Down
10 changes: 10 additions & 0 deletions client/user/signup.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
const passwordInput = document.getElementById('password');
const togglePassword = document.getElementById('toggle-password');
togglePassword.addEventListener('click', () => {
const isPassword = passwordInput.type === 'password';
passwordInput.type = isPassword ? 'text' : 'password';
togglePassword.querySelector('i').classList.toggle('bi-eye', !isPassword);
togglePassword.querySelector('i').classList.toggle('bi-eye-slash', isPassword);
togglePassword.setAttribute('aria-label', isPassword ? 'Hide password' : 'Show password');
});

const form = document.getElementById('signup-form');
form.addEventListener('submit', (event) => {
event.preventDefault();
Expand Down
Loading