From 13d576b3b52833ecae0261b15fb4e6d365026062 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Delobelle?= Date: Fri, 2 Sep 2016 14:17:11 +0200 Subject: [PATCH] Fix pwd account --- kfet/forms.py | 4 ++-- kfet/templates/kfet/kpsul.html | 19 ++++++++++--------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/kfet/forms.py b/kfet/forms.py index d587b6a9..ad1ea7d3 100644 --- a/kfet/forms.py +++ b/kfet/forms.py @@ -73,8 +73,8 @@ class AccountPwdForm(forms.Form): widget=forms.PasswordInput) def clean(self): - pwd1 = self.cleaned_data['pwd1'] - pwd2 = self.cleaned_data['pwd2'] + pwd1 = self.cleaned_data.get('pwd1', '') + pwd2 = self.cleaned_data.get('pwd2', '') if len(pwd1) < 8: raise ValidationError("Mot de passe trop court") if pwd1 != pwd2: diff --git a/kfet/templates/kfet/kpsul.html b/kfet/templates/kfet/kpsul.html index b9ff0a50..9322e9ba 100644 --- a/kfet/templates/kfet/kpsul.html +++ b/kfet/templates/kfet/kpsul.html @@ -344,7 +344,7 @@ $(document).ready(function() { }, onOpen: function() { var that = this; - this.$content.find('input').on('keypress', function(e) { + this.$content.find('input').on('keydown', function(e) { if (e.keyCode == 13) that.$confirmButton.click(); }); @@ -613,7 +613,7 @@ $(document).ready(function() { return false; } - articleSelect.on('keypress', function(e) { + articleSelect.on('keydown', function(e) { var text = articleSelect.val(); // Comportement normal pour ces touches if (normalKeys.test(e.keyCode) || e.ctrlKey) { @@ -621,7 +621,7 @@ $(document).ready(function() { performOperations(); if (e.keyCode == 8) updateMatchedArticles(text.substring(0,text.length-1), commit=false); - if (e.charCode == 97 && e.ctrlKey) { + if (e.charCode == 65 && e.ctrlKey) { articleId.val(0); articleSelect.val(''); } @@ -640,7 +640,7 @@ $(document).ready(function() { return /^[0-9]+$/.test(nb) && nb > 0 && nb <= 24; } - articleNb.on('keypress', function(e) { + articleNb.on('keydown', function(e) { if (e.keyCode == 13 && is_nb_ok(articleNb.val()) && articleId.val() > 0) { addPurchase(articleId.val(), articleNb.val()); articleSelect.val(''); @@ -650,11 +650,12 @@ $(document).ready(function() { return false; } if (normalKeys.test(e.keyCode) || arrowKeys.test(e.keyCode) || e.keyCode == 8 || e.ctrlKey) { - if (e.ctrlKey && e.charCode == 97) + if (e.ctrlKey && e.charCode == 65) articleNb.val(''); return true; } var nb = articleNb.val()+e.key; + print(nb); if (is_nb_ok(nb)) return true; return false; @@ -725,7 +726,7 @@ $(document).ready(function() { filter: 'tr', }); - $(document).on('keypress', function (e) { + $(document).on('keydown', function (e) { if (e.keyCode == 46) { // DEL (Suppr) basket_container.find('.ui-selected').each(function () { @@ -827,7 +828,7 @@ $(document).ready(function() { }, onOpen: function() { var that = this - this.$content.find('input').on('keypress', function(e) { + this.$content.find('input').on('keydown', function(e) { if (e.keyCode == 13) that.$confirmButton.click(); }); @@ -852,7 +853,7 @@ $(document).ready(function() { }, onOpen: function() { var that = this - this.$content.find('input').on('keypress', function(e) { + this.$content.find('input').on('keydown', function(e) { if (e.keyCode == 13) that.$confirmButton.click(); }); @@ -1013,7 +1014,7 @@ $(document).ready(function() { }, onOpen: function() { var that = this - this.$content.find('input[name=amount]').on('keypress', function(e) { + this.$content.find('input[name=amount]').on('keydown', function(e) { if (e.keyCode == 13) that.$confirmButton.click(); });