fix #13: increase max generated password length

This commit is contained in:
Antelle 2015-11-04 22:32:21 +03:00
parent 382cf8d139
commit 35c371d726
4 changed files with 17 additions and 5 deletions

View File

@ -22,6 +22,8 @@ var GeneratorView = Backbone.View.extend({
'click .gen__btn-ok': 'btnOkClick'
},
valuesMap: [3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,22,24,26,28,30,32,48,64],
initialize: function () {
$('body').one('click', this.remove.bind(this));
this.gen = _.clone(DefaultGenOpts);
@ -42,7 +44,7 @@ var GeneratorView = Backbone.View.extend({
},
lengthChange: function(e) {
var val = +e.target.value;
var val = this.valuesMap[e.target.value];
if (val !== this.gen.length) {
this.gen.length = val;
this.$el.find('.gen__length-range-val').html(val);
@ -61,6 +63,8 @@ var GeneratorView = Backbone.View.extend({
generate: function() {
this.password = PasswordGenerator.generate(this.gen);
this.resultEl.text(this.password);
var isLong = this.password.length > 32;
this.resultEl.toggleClass('gen__result--long-pass', isLong);
},
btnOkClick: function() {

View File

@ -2,7 +2,7 @@
position: absolute;
@include dropdown;
padding: $base-spacing;
width: 10em;
width: 11em;
&__length-range {
}
&__check {
@ -15,11 +15,14 @@
&__result {
@include user-select(text);
font-family: $monospace-font-family;
margin-top: $base-padding-v;
height: 4em;
margin-top: 6px;
height: 50px;
text-align: center;
white-space: pre;
word-wrap: break-word;
&--long-pass {
font-size: .75em;
}
}
&__btn-wrap {
text-align: center;

View File

@ -1,6 +1,6 @@
<div class="gen">
<div>Length: <span class="gen__length-range-val"><%= opt.length %></span></div>
<input type="range" class="gen__length-range" value="16" min="2" max="32" />
<input type="range" class="gen__length-range" value="13" min="0" max="25" />
<div>
<div class="gen__check"><input type="checkbox" id="gen__check-upper"
data-id="upper" <%= opt.upper ? 'checked' : '' %>><label for="gen__check-upper">ABC</label></div>

View File

@ -1,5 +1,10 @@
Release notes
-------------
##### v0.2.0 (not released yet)
Bugfixes and new features
`-` #12: cannot edit entries without title
`+` #13: increase max generated password length
##### v0.1.1 (2015-11-04)
Bugfix and performance enhancements
`+` support non-xml keyfiles