Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show password view is not updated #146

Open
shic opened this issue Sep 23, 2016 · 8 comments
Open

Show password view is not updated #146

shic opened this issue Sep 23, 2016 · 8 comments

Comments

@shic
Copy link

shic commented Sep 23, 2016

In the registration, check "Show password" option, and logout, when you redo login, the password is shown, but the "Show password" option is not checked.

screen shot 2016-09-23 at 17 29 58

@bartonhammond
Copy link
Owner

Good one. Looks like the checkbox component doesn't initialize w/ the current value from the Redux store.

@bartonhammond
Copy link
Owner

Would you consider addressing this and do a PR?

@bartonhammond
Copy link
Owner

@shic - are you going to provide a PR?

@sasongkoadi
Copy link

is this problem still not solve? @bartonhammond

@bartonhammond
Copy link
Owner

No - I'm not actively working on Snowflake. Notice the help wanted badge. If you want to fix this, then make a PR and I'll pull it in.

@sasongkoadi
Copy link

okay I'll try to solve that for first contribute on open source, thanks

@Phani-kp
Copy link

Mismatch of States:

When you log in again, the password is visible, but the "Show password" checkbox is not checked.
This indicates that the logic to toggle password visibility and the checkbox state are not synchronized during the login initialization.
Session Behavior:

If the password visibility state persists across sessions, the checkbox should also reflect the persisted state when the login form is loaded.
Potential Root Causes:

The "Show password" state (true/false) may be saved locally (e.g., in localStorage or sessionStorage) or in a cookie, but the checkbox state is not retrieved or initialized correctly.
The logic to set the password input type (text/password) on page load is inconsistent with the checkbox state.

@Phani-kp
Copy link

document.addEventListener('DOMContentLoaded', () => {
const showPasswordCheckbox = document.getElementById('show-password');
const passwordField = document.getElementById('password');

// Retrieve the saved state (default to false if not set)
const isPasswordVisible = localStorage.getItem('showPassword') === 'true';

// Set the password input type and checkbox state
passwordField.type = isPasswordVisible ? 'text' : 'password';
showPasswordCheckbox.checked = isPasswordVisible;

// Add event listener for toggling password visibility
showPasswordCheckbox.addEventListener('change', (e) => {
    const isChecked = e.target.checked;
    passwordField.type = isChecked ? 'text' : 'password';
    localStorage.setItem('showPassword', isChecked);
});

});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants