Browse Source

Try to disable remembering password

master
Eduard Kuzmenko 3 years ago
parent
commit
8019c81600
  1. 6
      src/components/inputField.ts
  2. 12
      src/components/passwordInputField.ts
  3. 1
      src/components/sidebarLeft/tabs/2fa/enterPassword.ts
  4. 6
      src/pages/pageAuthCode.ts
  5. 1
      src/pages/pagePassword.ts
  6. 4
      src/pages/pageSignIn.ts
  7. 14
      src/scss/style.scss

6
src/components/inputField.ts

@ -196,6 +196,12 @@ class InputField { @@ -196,6 +196,12 @@ class InputField {
this.input = input;
}
public select() {
if((this.input as HTMLInputElement).value) { // * avoid selecting whole empty field on iOS devices
(this.input as HTMLInputElement).select(); // * select text
}
}
public setLabel() {
this.label.textContent = '';
if(this.options.labelText) {

12
src/components/passwordInputField.ts

@ -22,11 +22,19 @@ export default class PasswordInputField extends InputField { @@ -22,11 +22,19 @@ export default class PasswordInputField extends InputField {
input.type = 'password';
input.setAttribute('required', '');
input.autocomplete = 'off';
input.readOnly = true;
/* input.readOnly = true;
input.addEventListener('focus', () => {
input.removeAttribute('readonly');
}, {once: true});
}, {once: true}); */
// * https://stackoverflow.com/a/35949954/6758968
const stealthy = document.createElement('input');
stealthy.classList.add('stealthy');
stealthy.tabIndex = -1;
stealthy.type = 'password';
input.parentElement.prepend(stealthy);
input.parentElement.insertBefore(stealthy.cloneNode(), input.nextSibling);
const toggleVisible = this.toggleVisible = document.createElement('span');
toggleVisible.classList.add('toggle-visible', 'tgico');

1
src/components/sidebarLeft/tabs/2fa/enterPassword.ts

@ -130,6 +130,7 @@ export default class AppTwoStepVerificationEnterPasswordTab extends SliderSuperT @@ -130,6 +130,7 @@ export default class AppTwoStepVerificationEnterPasswordTab extends SliderSuperT
textEl.key = 'TwoStepAuth.InvalidPassword';
textEl.update();
preloader.remove();
passwordInputField.select();
break;
}

6
src/pages/pageAuthCode.ts

@ -89,9 +89,11 @@ let onFirstMount = (): Promise<any> => { @@ -89,9 +89,11 @@ let onFirstMount = (): Promise<any> => {
break; */
}
}).catch(async(err) => {
let good = false;
switch(err.type) {
case 'SESSION_PASSWORD_NEEDED':
//console.warn('pageAuthCode: SESSION_PASSWORD_NEEDED');
good = true;
err.handled = true;
await pagePassword.mount();
break;
@ -109,6 +111,10 @@ let onFirstMount = (): Promise<any> => { @@ -109,6 +111,10 @@ let onFirstMount = (): Promise<any> => {
break;
}
if(!good) {
codeInputField.select();
}
codeInput.removeAttribute('disabled');
});
};

1
src/pages/pagePassword.ts

@ -100,6 +100,7 @@ let onFirstMount = (): Promise<any> => { @@ -100,6 +100,7 @@ let onFirstMount = (): Promise<any> => {
default:
//btnNext.innerText = err.type;
btnNextI18n.update({key: 'PASSWORD_HASH_INVALID'});
passwordInput.select();
break;
}

4
src/pages/pageSignIn.ts

@ -157,9 +157,7 @@ let onFirstMount = () => { @@ -157,9 +157,7 @@ let onFirstMount = () => {
void selectWrapper.offsetWidth; // reflow
selectWrapper.classList.add('active');
if(countryInput.value) { // * avoid selecting whole empty field on iOS devices
countryInput.select(); // * select text
}
countryInputField.select();
fastSmoothScroll(page.pageEl.parentElement.parentElement, countryInput, 'start', 4);

14
src/scss/style.scss

@ -1149,3 +1149,17 @@ middle-ellipsis-element { @@ -1149,3 +1149,17 @@ middle-ellipsis-element {
font-size: 20px !important;
padding: 0 2px;
}
.stealthy {
left: 0;
margin: 0;
max-height: 1px;
max-width: 1px;
opacity: 0;
outline: none;
overflow: hidden;
pointer-events: none;
position: absolute;
top: 0;
z-index: -1;
}

Loading…
Cancel
Save