final testing

This commit is contained in:
kkmanos 2021-12-14 17:08:46 +02:00
parent 8f2dcd24e9
commit 0a31f4d1f3
3 changed files with 12 additions and 11 deletions

View file

@ -7,7 +7,7 @@ import ipaddress
from distutils.util import strtobool
from yaml import Loader, load
from onelogin.saml2.utils import OneLogin_Saml2_Utils
from flask import Blueprint, render_template, make_response, url_for, current_app, g, session, request, redirect, abort, jsonify
from flask import Blueprint, render_template, render_template, make_response, url_for, current_app, g, session, request, redirect, abort, jsonify
from flask_login import login_user, logout_user, login_required, current_user
from zxcvbn import zxcvbn
@ -708,8 +708,8 @@ def rate_password():
}), 200)
result = zxcvbn(password, user_inputs=inputs)
defined_guesses_log = 11
# attrubutes to return as json
defined_guesses_log = int(Setting().get('zxcvbn_guesses_log'))
# attributes to return as json
feedback = []
rate = result['guesses_log10']/defined_guesses_log
if rate < 0.5:

View file

@ -106,10 +106,8 @@
{% if SETTING.get('zxcvbn_enabled')== true %}disabled{% endif %}>
</div>
<div class="form-group">
<label>
<label for="zxcvbn">Use zxcvbn python package</label>
<label for="zxcvbn">Use zxcvbn python package (If turned on, then the above password specifications will be disabled</label>
<input type="checkbox" class="checkbox" name="zxcvbn" id="zxcvbn" {% if SETTING.get('zxcvbn_enabled')== true %}checked{% endif %}>
</label>
</div>
<div class="form-group">
<button type="submit" class="btn btn-flat btn-primary">Save</button>
@ -759,11 +757,11 @@
<script>
$('input').on('ifChecked', function(event){
$('#zxcvbn').on('ifChecked', function(event){
// alert(event.type + ' callback');
$(".form-control.char_specified").prop("disabled", true)
});
$('input').on('ifUnchecked', function(event){
$('#zxcvbn').on('ifUnchecked', function(event){
// alert(event.type + ' callback');
$(".form-control.char_specified").prop("disabled", false)
});

View file

@ -89,9 +89,6 @@ function send_pass() {
type: "post",
data : { 'logged_in' : {{is_logged_in}} ,'fname': fname, 'lname': lname, 'email' : email, 'username' : username, 'password': password},
success: function(response) {
console.log('Submission was successful.');
console.log("Resp = " , response)
console.log('sccess')
var x = document.getElementById('policy-err');
// x.innerHTML = response['feedback'];
x.innerHTML = "<ul>";
@ -149,6 +146,12 @@ $(':input').on('keyup', function() {
{% endif %}
document.getElementById('pwd-submit').disabled = true;
}
else {
{% if is_logged_in == 1 %}
document.getElementById('retype-err').innerHTML = '';
{% endif %}
}
var seconds = 1;
if (timer == null) { // if user typed sth and timer is not running, then start one