final testing
This commit is contained in:
parent
8f2dcd24e9
commit
0a31f4d1f3
|
@ -7,7 +7,7 @@ import ipaddress
|
||||||
from distutils.util import strtobool
|
from distutils.util import strtobool
|
||||||
from yaml import Loader, load
|
from yaml import Loader, load
|
||||||
from onelogin.saml2.utils import OneLogin_Saml2_Utils
|
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 flask_login import login_user, logout_user, login_required, current_user
|
||||||
from zxcvbn import zxcvbn
|
from zxcvbn import zxcvbn
|
||||||
|
|
||||||
|
@ -708,8 +708,8 @@ def rate_password():
|
||||||
}), 200)
|
}), 200)
|
||||||
|
|
||||||
result = zxcvbn(password, user_inputs=inputs)
|
result = zxcvbn(password, user_inputs=inputs)
|
||||||
defined_guesses_log = 11
|
defined_guesses_log = int(Setting().get('zxcvbn_guesses_log'))
|
||||||
# attrubutes to return as json
|
# attributes to return as json
|
||||||
feedback = []
|
feedback = []
|
||||||
rate = result['guesses_log10']/defined_guesses_log
|
rate = result['guesses_log10']/defined_guesses_log
|
||||||
if rate < 0.5:
|
if rate < 0.5:
|
||||||
|
|
|
@ -106,10 +106,8 @@
|
||||||
{% if SETTING.get('zxcvbn_enabled')== true %}disabled{% endif %}>
|
{% if SETTING.get('zxcvbn_enabled')== true %}disabled{% endif %}>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>
|
<label for="zxcvbn">Use zxcvbn python package (If turned on, then the above password specifications will be disabled</label>
|
||||||
<label for="zxcvbn">Use zxcvbn python package</label>
|
|
||||||
<input type="checkbox" class="checkbox" name="zxcvbn" id="zxcvbn" {% if SETTING.get('zxcvbn_enabled')== true %}checked{% endif %}>
|
<input type="checkbox" class="checkbox" name="zxcvbn" id="zxcvbn" {% if SETTING.get('zxcvbn_enabled')== true %}checked{% endif %}>
|
||||||
</label>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<button type="submit" class="btn btn-flat btn-primary">Save</button>
|
<button type="submit" class="btn btn-flat btn-primary">Save</button>
|
||||||
|
@ -759,11 +757,11 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
$('input').on('ifChecked', function(event){
|
$('#zxcvbn').on('ifChecked', function(event){
|
||||||
// alert(event.type + ' callback');
|
// alert(event.type + ' callback');
|
||||||
$(".form-control.char_specified").prop("disabled", true)
|
$(".form-control.char_specified").prop("disabled", true)
|
||||||
});
|
});
|
||||||
$('input').on('ifUnchecked', function(event){
|
$('#zxcvbn').on('ifUnchecked', function(event){
|
||||||
// alert(event.type + ' callback');
|
// alert(event.type + ' callback');
|
||||||
$(".form-control.char_specified").prop("disabled", false)
|
$(".form-control.char_specified").prop("disabled", false)
|
||||||
});
|
});
|
||||||
|
|
|
@ -89,9 +89,6 @@ function send_pass() {
|
||||||
type: "post",
|
type: "post",
|
||||||
data : { 'logged_in' : {{is_logged_in}} ,'fname': fname, 'lname': lname, 'email' : email, 'username' : username, 'password': password},
|
data : { 'logged_in' : {{is_logged_in}} ,'fname': fname, 'lname': lname, 'email' : email, 'username' : username, 'password': password},
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
console.log('Submission was successful.');
|
|
||||||
console.log("Resp = " , response)
|
|
||||||
console.log('sccess')
|
|
||||||
var x = document.getElementById('policy-err');
|
var x = document.getElementById('policy-err');
|
||||||
// x.innerHTML = response['feedback'];
|
// x.innerHTML = response['feedback'];
|
||||||
x.innerHTML = "<ul>";
|
x.innerHTML = "<ul>";
|
||||||
|
@ -149,6 +146,12 @@ $(':input').on('keyup', function() {
|
||||||
{% endif %}
|
{% endif %}
|
||||||
document.getElementById('pwd-submit').disabled = true;
|
document.getElementById('pwd-submit').disabled = true;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
{% if is_logged_in == 1 %}
|
||||||
|
|
||||||
|
document.getElementById('retype-err').innerHTML = '';
|
||||||
|
{% endif %}
|
||||||
|
}
|
||||||
|
|
||||||
var seconds = 1;
|
var seconds = 1;
|
||||||
if (timer == null) { // if user typed sth and timer is not running, then start one
|
if (timer == null) { // if user typed sth and timer is not running, then start one
|
||||||
|
|
Loading…
Reference in a new issue