Skip to content
This repository has been archived by the owner on Jun 17, 2022. It is now read-only.

when password visibility is toggled the cursor keeps the current sele… #396

Closed
wants to merge 1 commit into from
Closed
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
7 changes: 6 additions & 1 deletion src/angular/components/add-edit.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,12 @@ export class AddEditComponent implements OnInit {

togglePassword() {
this.showPassword = !this.showPassword;
document.getElementById('loginPassword').focus();
const inputField: any = document.getElementById('loginPassword');
const cursorPosition = [inputField.selectionStart, inputField.selectionEnd];
inputField.focus();
if (cursorPosition) {
setTimeout(() => inputField.setSelectionRange(cursorPosition[0], cursorPosition[1]), 10);
}
if (this.editMode && this.showPassword) {
this.eventService.collect(EventType.Cipher_ClientToggledPasswordVisible, this.cipherId);
}
Expand Down
7 changes: 6 additions & 1 deletion src/angular/components/export.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@ export class ExportComponent {

togglePassword() {
this.showPassword = !this.showPassword;
document.getElementById('masterPassword').focus();
const inputField: any = document.getElementById('masterPassword');
const cursorPosition = [inputField.selectionStart, inputField.selectionEnd];
inputField.focus();
if (cursorPosition) {
setTimeout(() => inputField.setSelectionRange(cursorPosition[0], cursorPosition[1]), 10);
}
}

protected saved() {
Expand Down
7 changes: 6 additions & 1 deletion src/angular/components/lock.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,12 @@ export class LockComponent implements OnInit {

togglePassword() {
this.showPassword = !this.showPassword;
document.getElementById(this.pinLock ? 'pin' : 'masterPassword').focus();
const inputField: any = document.getElementById(this.pinLock ? 'pin' : 'masterPassword');
const cursorPosition = [inputField.selectionStart, inputField.selectionEnd];
inputField.focus();
if (cursorPosition) {
setTimeout(() => inputField.setSelectionRange(cursorPosition[0], cursorPosition[1]), 10);
}
}

private async setKeyAndContinue(key: SymmetricCryptoKey) {
Expand Down
7 changes: 6 additions & 1 deletion src/angular/components/login.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,12 @@ export class LoginComponent implements OnInit {

togglePassword() {
this.showPassword = !this.showPassword;
document.getElementById('masterPassword').focus();
const inputField: any = document.getElementById('masterPassword');
const cursorPosition = [inputField.selectionStart, inputField.selectionEnd];
inputField.focus();
if (cursorPosition) {
setTimeout(() => inputField.setSelectionRange(cursorPosition[0], cursorPosition[1]), 10);
}
}

async launchSsoBrowser(clientId: string, ssoRedirectUri: string) {
Expand Down
10 changes: 9 additions & 1 deletion src/angular/components/register.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,15 @@ export class RegisterComponent {

togglePassword(confirmField: boolean) {
this.showPassword = !this.showPassword;
document.getElementById(confirmField ? 'masterPasswordRetype' : 'masterPassword').focus();
const inputField: any = document.getElementById(confirmField ? 'masterPasswordRetype' : 'masterPassword');
const cursorPosition = [inputField.selectionStart, inputField.selectionEnd];
inputField.focus();



if (cursorPosition) {
setTimeout(() => inputField.setSelectionRange(cursorPosition[0], cursorPosition[1]), 10);
}
}

updatePasswordStrength() {
Expand Down
7 changes: 6 additions & 1 deletion src/angular/components/set-password.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ export class SetPasswordComponent extends BaseChangePasswordComponent {

togglePassword(confirmField: boolean) {
this.showPassword = !this.showPassword;
document.getElementById(confirmField ? 'masterPasswordRetype' : 'masterPassword').focus();
const inputField: any = document.getElementById(confirmField ? 'masterPasswordRetype' : 'masterPassword');
const cursorPosition = [inputField.selectionStart, inputField.selectionEnd];
inputField.focus();
if (cursorPosition) {
setTimeout(() => inputField.setSelectionRange(cursorPosition[0], cursorPosition[1]), 10);
}
}
}