Fixed password page and created lib folder for client-side libraries

master
Keith Irwin 2018-03-31 05:31:02 +00:00
parent bec97e3bb3
commit 6c934544f1
No known key found for this signature in database
GPG Key ID: 378933C743E2BBC0
10 changed files with 42 additions and 14 deletions

View File

@ -1 +1 @@
"use strict";const zxcvbn=require("zxcvbn");function checkMatch(){$("#submit").prop("title","You need to type your password again before you can save it. "),$("#p1").val()===$("#p2").val()?$("#submit").prop("disabled",!1).prop("title","Click here to save your password. "):""!==$("#p2").val()&&($("#password-help").text("Those passwords don't match... ").css({color:"#fb6e3d"}),$("#submit").prop("disabled",!0).prop("title","You need to type the same password twice before you can save it. "))}$(function(){$(".password").keyup(function(){if(""===$("#p1").val()&&""===$("#p2").val())$("#password-help").hide(),$("#submit").prop("disabled",!0).prop("title","You need to enter a password first. ");else if(""===$("#p1").val())$("#password-help").show().text("Those passwords don't match... "),$("#submit").prop("disabled",!0).prop("title","You need to type the same password twice correctly before you can save it. ");else{$("#password-help").show();let e=zxcvbn($("#p1").val());e.crack_times_seconds.online_no_throttling_10_per_second<3600?($("#password-help").text("That password is way too common or simple. You may not use it for Tracman and should not use it anywhere. ").css({color:"#fb6e3d"}),$("#submit").prop("disabled",!0).prop("title","You need to come up with a better password. ")):e.crack_times_seconds.online_no_throttling_10_per_second<86400?($("#password-help").text("That password is pretty bad. It could be cracked in "+e.crack_times_display.online_no_throttling_10_per_second+". Try adding more words, numbers, or symbols. ").css({color:"#fb6e3d"}),$("#submit").prop("disabled",!0).prop("title","You need to come up with a better password. ")):e.crack_times_seconds.online_no_throttling_10_per_second<864e3?($("#password-help").text("That password isn't good enough. It could be cracked in "+e.crack_times_display.online_no_throttling_10_per_second+". Try adding another word, number, or symbol. ").css({color:"#fb6e3d"}),$("#submit").prop("disabled",!0).prop("title","You need to come up with a better password. ")):e.crack_times_seconds.online_no_throttling_10_per_second<=2592e3?($("#password-help").text("That password is good enough, but it could still be cracked in "+e.crack_times_display.online_no_throttling_10_per_second+". ").css({color:"#eee"}),checkMatch()):e.crack_times_seconds.online_no_throttling_10_per_second<=1314e3?($("#password-help").text("That password is good. It would take "+e.crack_times_display.online_no_throttling_10_per_second+" to crack. ").css({color:"#8ae137"}),checkMatch()):($("#password-help").text("That password is great! It could take "+e.crack_times_display.online_no_throttling_10_per_second+" to crack!").css({color:"#8ae137"}),checkMatch())}}),$("#show").click(function(){$(this).is(":checked")?$(".password").attr("type","text"):$(".password").attr("type","password")})});
"use strict";function checkMatch(){$("#submit").prop("title","You need to type your password again before you can save it. "),$("#p1").val()===$("#p2").val()?$("#submit").prop("disabled",!1).prop("title","Click here to save your password. "):""!==$("#p2").val()&&($("#password-help").text("Those passwords don't match... ").css({color:"#fb6e3d"}),$("#submit").prop("disabled",!0).prop("title","You need to type the same password twice before you can save it. "))}$(function(){$(".password").keyup(function(){if(""===$("#p1").val()&&""===$("#p2").val())$("#password-help").hide(),$("#submit").prop("disabled",!0).prop("title","You need to enter a password first. ");else if(""===$("#p1").val())$("#password-help").show().text("Those passwords don't match... "),$("#submit").prop("disabled",!0).prop("title","You need to type the same password twice correctly before you can save it. ");else{$("#password-help").show();let e=zxcvbn($("#p1").val());e.crack_times_seconds.online_no_throttling_10_per_second<3600?($("#password-help").text("That password is way too common or simple. You may not use it for Tracman and should not use it anywhere. ").css({color:"#fb6e3d"}),$("#submit").prop("disabled",!0).prop("title","You need to come up with a better password. ")):e.crack_times_seconds.online_no_throttling_10_per_second<86400?($("#password-help").text("That password is pretty bad. It could be cracked in "+e.crack_times_display.online_no_throttling_10_per_second+". Try adding more words, numbers, or symbols. ").css({color:"#fb6e3d"}),$("#submit").prop("disabled",!0).prop("title","You need to come up with a better password. ")):e.crack_times_seconds.online_no_throttling_10_per_second<864e3?($("#password-help").text("That password isn't good enough. It could be cracked in "+e.crack_times_display.online_no_throttling_10_per_second+". Try adding another word, number, or symbol. ").css({color:"#fb6e3d"}),$("#submit").prop("disabled",!0).prop("title","You need to come up with a better password. ")):e.crack_times_seconds.online_no_throttling_10_per_second<=2592e3?($("#password-help").text("That password is good enough, but it could still be cracked in "+e.crack_times_display.online_no_throttling_10_per_second+". ").css({color:"#eee"}),checkMatch()):e.crack_times_seconds.online_no_throttling_10_per_second<=1314e3?($("#password-help").text("That password is good. It would take "+e.crack_times_display.online_no_throttling_10_per_second+" to crack. ").css({color:"#8ae137"}),checkMatch()):($("#password-help").text("That password is great! It could take "+e.crack_times_display.online_no_throttling_10_per_second+" to crack!").css({color:"#8ae137"}),checkMatch())}}),$("#show").click(function(){$(this).is(":checked")?$(".password").attr("type","text"):$(".password").attr("type","password")})});

1
static/js/lib/.zxcvbn.min.js vendored Normal file

File diff suppressed because one or more lines are too long

28
static/js/lib/zxcvbn.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,5 @@
'use strict'
/* global $ */
const zxcvbn = require('zxcvbn')
/* global $ zxcvbn */
function checkMatch () {
$('#submit')

View File

@ -9,6 +9,7 @@
{% block javascript %}
{{super()}}
<script type="application/javascript" src="/static/js/lib/.zxcvbn.min.js"></script>
<script type="application/javascript" src="/static/js/.password.min.js"></script>
{% endblock %}

View File

@ -50,8 +50,8 @@
<!-- Head javascript imports -->
<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
<!--[if lt IE 9]>
<script src="/scripts/.html5shiv.min.js"></script>
<script src="/scripts/.respond.min.js"></script>
<script src="/scripts/lib/.html5shiv.min.js"></script>
<script src="/scripts/lib/.respond.min.js"></script>
<![endif]-->
{% endblock %}