testing1
This commit is contained in:
parent
9fe042df3b
commit
90937e599e
|
@ -771,7 +771,7 @@ def register():
|
||||||
lastname=lastname,
|
lastname=lastname,
|
||||||
email=email)
|
email=email)
|
||||||
|
|
||||||
if not password_quality_check(user, password):
|
if Setting().get('zxcvbn_enabled') == False and not password_quality_check(user, password):
|
||||||
return render_template('register.html', error="Password does not meet the policy requirements")
|
return render_template('register.html', error="Password does not meet the policy requirements")
|
||||||
try:
|
try:
|
||||||
result = user.create_local_user()
|
result = user.create_local_user()
|
||||||
|
|
|
@ -46,8 +46,7 @@ def profile():
|
||||||
lastname = request.form.get('lastname', '').strip()
|
lastname = request.form.get('lastname', '').strip()
|
||||||
email = request.form.get('email', '').strip()
|
email = request.form.get('email', '').strip()
|
||||||
new_password = request.form.get('password', '')
|
new_password = request.form.get('password', '')
|
||||||
if not password_quality_check(current_user, new_password):
|
if Setting().get('zxcvbn_enabled') == False and not password_quality_check(current_user, new_password):
|
||||||
# return render_template('errors/400.html', msg="Password does not meet the policy requirements")
|
|
||||||
return render_template('user_profile.html', change_pass_tab = True, user_info = current_user.get_user_info_by_username() , zxcvbn_enabled=Setting().get('zxcvbn_enabled'), error="Password does not meet the policy requirements")
|
return render_template('user_profile.html', change_pass_tab = True, user_info = current_user.get_user_info_by_username() , zxcvbn_enabled=Setting().get('zxcvbn_enabled'), error="Password does not meet the policy requirements")
|
||||||
else:
|
else:
|
||||||
firstname = lastname = email = new_password = ''
|
firstname = lastname = email = new_password = ''
|
||||||
|
|
|
@ -19,9 +19,8 @@ $.ajaxSetup({
|
||||||
var n_digits = parseInt("{{ pwd_min_digits }}");
|
var n_digits = parseInt("{{ pwd_min_digits }}");
|
||||||
var n_special = parseInt("{{ pwd_min_special }}");
|
var n_special = parseInt("{{ pwd_min_special }}");
|
||||||
var must_not_contain = "{{ pwd_must_not_contain }}";
|
var must_not_contain = "{{ pwd_must_not_contain }}";
|
||||||
var pattern = "^(?=(?:.*[0-9]){" + n_digits + ",})(?=(?:.*[a-z]){" + n_lower + ",})(?=(?:.*[A-Z]){" + n_upper + ",})(?=(?:.*[[!@#$%^&*()_+]){" + n_special + ",}).+$";
|
// var pattern = "^(?=(?:.*[0-9]){" + n_digits + ",})(?=(?:.*[a-z]){" + n_lower + ",})(?=(?:.*[A-Z]){" + n_upper + ",})(?=(?:.*[[!@#$%^&*()_+]){" + n_special + ",}).+$";
|
||||||
|
// var PasswordRegEx = new RegExp(pattern, 'm');
|
||||||
var PasswordRegEx = new RegExp(pattern, 'm');
|
|
||||||
var upper_found = 0;
|
var upper_found = 0;
|
||||||
var lower_found = 0;
|
var lower_found = 0;
|
||||||
var digits_found = 0;
|
var digits_found = 0;
|
||||||
|
@ -31,10 +30,10 @@ $.ajaxSetup({
|
||||||
var digits_pattern = /[0-9]/g;
|
var digits_pattern = /[0-9]/g;
|
||||||
var special_pattern = /[[!@#$%^&*()_+]/g;
|
var special_pattern = /[[!@#$%^&*()_+]/g;
|
||||||
for (var i = 0; i < pass.length; i++) {
|
for (var i = 0; i < pass.length; i++) {
|
||||||
if (pass[i].match(special_pattern)) special_found++;
|
if (pass[i].match(special_pattern)) special_found++;
|
||||||
else if (pass[i].match(lower_pattern)) lower_found++;
|
else if (pass[i].match(lower_pattern)) lower_found++;
|
||||||
else if (pass[i].match(upper_pattern)) upper_found++;
|
else if (pass[i].match(upper_pattern)) upper_found++;
|
||||||
else if (pass[i].match(digits_pattern)) digits_found++;
|
else if (pass[i].match(digits_pattern)) digits_found++;
|
||||||
}
|
}
|
||||||
var msg = "";
|
var msg = "";
|
||||||
if (pass.length < pwd_len) msg += 'at least ' + pwd_len + ' character(s)<br>'
|
if (pass.length < pwd_len) msg += 'at least ' + pwd_len + ' character(s)<br>'
|
||||||
|
|
|
@ -123,31 +123,16 @@
|
||||||
var pass = input.value;
|
var pass = input.value;
|
||||||
if (rpass != pass || rpass.length == 0 || pass.length == 0) {
|
if (rpass != pass || rpass.length == 0 || pass.length == 0) {
|
||||||
document.getElementById('pwd-submit').disabled = true;
|
document.getElementById('pwd-submit').disabled = true;
|
||||||
// document.getElementById('retype-err').innerHTML = 'Password confirmation does not match';
|
|
||||||
}
|
}
|
||||||
// else {
|
|
||||||
// document.getElementById('retype-err').innerHTML = '';
|
|
||||||
// }
|
|
||||||
var fname = document.getElementById('firstname').value;
|
var fname = document.getElementById('firstname').value;
|
||||||
var lname = document.getElementById('lastname').value;
|
var lname = document.getElementById('lastname').value;
|
||||||
var email = document.getElementById('email').value;
|
var email = document.getElementById('email').value;
|
||||||
var username = document.getElementById('username').value;
|
var username = document.getElementById('username').value;
|
||||||
|
|
||||||
charbased_password_policy(fname, lname, username, email, pass, rpass);
|
charbased_password_policy(fname, lname, username, email, pass, rpass);
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
{% else %}
|
|
||||||
// var csrftoken = $('meta[name=csrf-token]').attr('content')
|
|
||||||
|
|
||||||
// $.ajaxSetup({
|
|
||||||
// beforeSend: function(xhr, settings) {
|
|
||||||
// if (!/^(GET|HEAD|OPTIONS|TRACE)$/i.test(settings.type) && !this.crossDomain) {
|
|
||||||
// xhr.setRequestHeader("X-CSRFToken", csrftoken)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Reference in a new issue