Fix password generation's handling of the ambiguous option. (#100)

* Fix password generation's handling of the ambiguous option.

Fixes #97

* Invert options.ambiguous's value in the UI.

options.ambiguous means "allow ambiguous characters", however the
checkbox is labeled "avoid ambiguous characters".  inverse the value at
display time to reflect to reflect reality.
This commit is contained in:
byron jones 2017-03-02 11:55:37 +08:00 committed by Kyle Spearrin
parent b2d479f882
commit 0298c19e13
2 changed files with 4 additions and 2 deletions

View File

@ -70,7 +70,9 @@
<div class="list-section-items">
<div class="list-section-item list-section-item-checkbox">
<label for="ambiguous">{{i18n.avoidAmbChar}}</label>
<input id="ambiguous" type="checkbox" ng-model="options.ambiguous" ng-change="saveOptions(options)">
<input id="ambiguous" type="checkbox" ng-model="options.ambiguous"
ng-true-value="false" ng-false-value="true"
ng-change="saveOptions(options)">
</div>
</div>
</div>

View File

@ -103,7 +103,7 @@ function initPasswordGenerationService() {
// ref https://github.com/EFForg/OpenWireless/blob/master/app/js/diceware.js
function randomInt(min, max) {
var rval = 0;
var range = max - min;
var range = max - min + 1;
var bits_needed = Math.ceil(Math.log2(range));
if (bits_needed > 53) {