Browse Source

disable send for weak pass

merge-requests/9/head
Kali Kaneko 4 years ago
parent
commit
8bd632a5f9
  1. 15
      assets/zxcvbn-bootstrap-strength-meter.js
  2. 2
      tmpl/adduser.html
  3. 2
      tmpl/index.html
  4. 2
      tmpl/password.html

15
assets/zxcvbn-bootstrap-strength-meter.js vendored

@ -1,6 +1,14 @@
//Requires zxcvbn.js and Bootstrap
(function ($) {
function disableSend () {
$('#cambiapass').prop('disabled', true).addClass('disabled');
}
function enableSend () {
$('#cambiapass').prop('disabled', false).removeClass('disabled');
}
$.fn.zxcvbnProgressBar = function (options) {
//init settings
@ -41,26 +49,31 @@
//weak
$(progressBar).removeClass(settings.allProgressBarClasses).addClass(settings.progressBarClass0);
$(progressBar).html(settings.ratings[0]);
disableSend();
}
else if (result.score == 1) {
//normal
$(progressBar).removeClass(settings.allProgressBarClasses).addClass(settings.progressBarClass1);
$(progressBar).html(settings.ratings[1]);
disableSend();
}
else if (result.score == 2) {
//medium
$(progressBar).removeClass(settings.allProgressBarClasses).addClass(settings.progressBarClass2);
$(progressBar).html(settings.ratings[2]);
disableSend();
}
else if (result.score == 3) {
//strong
$(progressBar).removeClass(settings.allProgressBarClasses).addClass(settings.progressBarClass3);
$(progressBar).html(settings.ratings[3]);
enableSend();
}
else if (result.score == 4) {
//very strong
$(progressBar).removeClass(settings.allProgressBarClasses).addClass(settings.progressBarClass4);
$(progressBar).html(settings.ratings[4]);
enableSend();
}
}
else {
@ -70,4 +83,4 @@
}
}
};
})(jQuery);
})(jQuery);

2
tmpl/adduser.html

@ -38,7 +38,7 @@
<input type="password" class="form-control {{if eq .Data "WrongPass"}}is-invalid{{end}}" id="password2" name="password2" placeholder="Contraseña">
<div class="invalid-feedback">No has introducido la misma contraseña.</div>
</div>
<button type="submit" class="btn btn-primary">Crear</button>
<button id="cambiapass" type="submit" class="btn btn-primary">Crear</button>
</form>
</div>
</div>

2
tmpl/index.html

@ -56,7 +56,7 @@
<input type="password" class="form-control" id="password2" name="password2" placeholder="Contraseña">
<div class="invalid-feedback">No ha introducido la misma contraseña.</div>
</div>
<button type="submit" class="btn btn-primary">Cambiar</button>
<button id="cambiapass" type="submit" class="btn btn-primary">Cambiar</button>
</form>
</div>

2
tmpl/password.html

@ -34,7 +34,7 @@
<input type="password" class="form-control {{if eq .Data "WrongPass"}}is-invalid{{end}}" id="password2" name="password2" placeholder="Contraseña">
<div class="invalid-feedback">Volvemos otra vez ya que no has introducido la misma contraseña.</div>
</div>
<button type="submit" class="btn btn-primary">Cambiar</button>
<button id="cambiapass" type="submit" class="btn btn-primary">Cambiar</button>
</form>
</div>
{{end}}

Loading…
Cancel
Save