Fix pwd account

This commit is contained in:
Aurélien Delobelle 2016-09-02 14:17:11 +02:00
parent 723a35b7ad
commit 13d576b3b5
2 changed files with 12 additions and 11 deletions

View file

@ -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:

View file

@ -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();
});