Skip to content

Commit

Permalink
#749 Mask PIN numbers by default during SSO logins
Browse files Browse the repository at this point in the history
  • Loading branch information
adiganga2002 committed May 31, 2022
1 parent 05e813a commit 2d3a1f5
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 3 deletions.
16 changes: 15 additions & 1 deletion controllers/MainController.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,16 @@ function MainController() {

};

this.toggleShowPin = function () {
this.showPin = !this.showPin;
this.pinUpdate("");
}

this.clearPin = function () {
this.pinInput.value = "";
this.pinUpdate("");
}

this.pinUpdate = function (value) {
this.pinInput = document.getElementById('sso-pincode');

Expand All @@ -331,7 +341,11 @@ function MainController() {

if (this.pinInput.value.length <= 6) {
Array.from(document.getElementsByClassName('number-input')).forEach((item, index) => {
item.innerText = this.pinInput.value[index] || "";
if (this.showPin) {
this.pinInput.value[index] ? item.innerText = this.pinInput.value[index] : item.innerText = "";
} else {
this.pinInput.value[index] ? item.innerText = "*" : item.innerText = "";
}
})
}
}
Expand Down
26 changes: 24 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
width: 65px;
}

.view-pin, .clear-pin {
margin: 10px 0px;
}

.input-wrapper {
width: 100%;
display: flex;
Expand All @@ -30,8 +34,8 @@
height: 35px;
width: 35px;
border: 1px solid #FFFFFF;
font-size: 2em;
line-height: 1.2em;
font-size: 1.5em;
line-height: 1.5em;
text-align: center;
}

Expand Down Expand Up @@ -95,6 +99,24 @@
<span class="number-input text-secondary"></span>
<span class="number-input text-secondary"></span>
</div>
<div class="buttons-row">
<div class="view-pin">
<button class="btn btn-outline-secondary"
id="btn-view-pin"
onclick="controller.toggleShowPin()"
type="button">
Show pin
</button>
</div>
<div class="clear-pin">
<button class="btn btn-outline-secondary"
id="btn-clear-pin"
onclick="controller.clearPin()"
type="button">
Clear all
</button>
</div>
</div>
<div class="buttons-row">
<input class="text-center form-control-lg mb-2 w-100" hidden id="sso-pincode" type="text">
</div>
Expand Down

0 comments on commit 2d3a1f5

Please sign in to comment.