Skip to content

Commit 315d229

Browse files
committed
Merge pull request #106 from devgeeks/show-password-toggle
The UX battle over displaying or masking the passphrase rages on
2 parents b2193a5 + 872c871 commit 315d229

File tree

3 files changed

+63
-5
lines changed

3 files changed

+63
-5
lines changed

src/views/SignupView.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,26 @@
1111
events: {
1212
"submit form": "form_submitHandler",
1313
"click .signupButton": "signupButton_clickHandler",
14-
"click a.backToLogin": "backToLogin_clickHandler"
14+
"click a.backToLogin": "backToLogin_clickHandler",
15+
"change #show-passphrase": "showPassphrase_changeHandler"
1516
},
1617
initialize: function() {
1718
_.bindAll(this,
1819
"input_focusHandler",
1920
"input_blurHandler",
2021
"form_submitHandler",
2122
"signupButton_clickHandler",
22-
"backToLogin_clickHandler");
23+
"backToLogin_clickHandler",
24+
"showPassphrase_changeHandler");
2325
$(document).on("focus", ".signup input", this.input_focusHandler);
2426
$(document).on("blur", ".signup input", this.input_blurHandler);
2527
},
2628
render: function() {
2729
this.$el.html(window.tmpl["signupView"]({}));
2830
$(".app").append(this.el);
31+
if ($.os.nodeWebkit) this.$("input[type=checkbox]").css({
32+
"height": "15px"
33+
});
2934
return this;
3035
},
3136
input_focusHandler: function(event) {
@@ -34,6 +39,9 @@
3439
input_blurHandler: function(event) {
3540
$(event.target).closest("div.login-input").removeClass("focused");
3641
},
42+
showPassphrase_changeHandler: function(event) {
43+
this.$("#newpassphrase").toggleClass("passphrase-shown");
44+
},
3745
form_submitHandler: function(event) {
3846
var _this = this;
3947
event.preventDefault();

tpl/signupView.html

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,20 @@ <h1 class="middle">Register</h1>
1212
<input id="newpassphrase" type="text" name="newpassphrase"
1313
placeholder="Choose a Passphrase"
1414
autocomplete="off" autocorrect="off" autocapitalize="off"
15-
tabindex="2" />
15+
tabindex="2" class="passphrase-shown" />
16+
</div>
17+
<div class="login-input checkbox-container">
18+
<label for="show-passphrase"> Show passphrase
19+
<input type="checkbox" id="show-passphrase" checked="checked"
20+
class="show-passphrase" />
21+
</label>
1622
</div>
1723
<a class="button signupButton primary" tabindex="-1">Register</a>
18-
<div class="middle backToLoginLink"><a class="backToLogin">Back to login &raquo;</a></div>
24+
<div class="middle backToLoginLink">
25+
<a class="backToLogin">Back to login &raquo;</a>
26+
</div>
1927
<input type="submit" style="visibility:hidden" tabindex="-1"/>
2028
</form>
2129
</div>
22-
<div style="width:150px; margin:-10px auto; opacity:0.4;"><img style="width: 150px" src="img/zk.png" /></div>
30+
<div style="width:150px; margin:-10px auto; opacity:0.4;">
31+
<img style="width: 150px" src="img/zk.png" /></div>

www/css/index.css

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,10 +316,51 @@ input[type="password"] {
316316
border-bottom-right-radius: 5px;
317317
border-bottom: none;
318318
}
319+
#newpassphrase {
320+
-webkit-text-security: disc;
321+
-moz-text-security: disc;
322+
text-security: disc;
323+
}
324+
#newpassphrase.passphrase-shown {
325+
-webkit-text-security: none;
326+
-moz-text-security: none;
327+
text-security: none;
328+
}
319329
div.login-input {
320330
-webkit-box-sizing: border-box;
321331
padding: 0 20px;
322332
}
333+
.login-input.checkbox-container {
334+
height: 30px;
335+
margin: 5px 0 0 0;
336+
text-align: right;
337+
line-height: 30px;
338+
}
339+
.login-input label {
340+
}
341+
.login-input input[type=checkbox] {
342+
visibility: hidden;
343+
margin: 0 10px 0 10px;
344+
}
345+
.login-input input[type=checkbox]:checked:after {
346+
position: relative;
347+
top: -3px;
348+
color: #fff;
349+
font-family: FontAwesome;
350+
content: '\f058';
351+
visibility: visible;
352+
font-size: 25px;
353+
}
354+
.login-input input[type=checkbox]:after {
355+
position: relative;
356+
top: -3px;
357+
color: #fff;
358+
font-family: FontAwesome;
359+
/*content: '\f10c';*/
360+
content: '\f111';
361+
visibility: visible;
362+
font-size: 25px;
363+
}
323364
.signupLink,
324365
.backToLoginLink {
325366
margin-top: 20px;

0 commit comments

Comments
 (0)