mirror of
https://github.com/QingdaoU/OnlineJudge.git
synced 2024-09-21 08:23:20 +00:00
Accept Merge Request #13 : (sxw-dev -> dev)
Merge Request: 添加了Tools中windows脚本;修改重复密码表单校验js Created By: @esp Accepted By: @esp URL: https://coding.net/u/virusdefender/p/qduoj/git/merge/13
This commit is contained in:
commit
f04eaae129
@ -1,7 +1,4 @@
|
||||
|
||||
require(["jquery", "bs_alert", "csrf", "validation"], function($, bs_alert, csrfHeader){
|
||||
|
||||
|
||||
$("#change_password-form").formValidation({
|
||||
framework: "bootstrap",
|
||||
fields: {
|
||||
@ -28,20 +25,11 @@ require(["jquery", "bs_alert", "csrf", "validation"], function($, bs_alert, csrf
|
||||
min: 6,
|
||||
max: 30,
|
||||
message: '密码长度必须在6到30位之间'
|
||||
},
|
||||
confirm: {
|
||||
firstPassword: $("#new_password"),
|
||||
secondPassword: $("#confirm_password"),
|
||||
message: "两次输入的密码必须一致"
|
||||
}
|
||||
},
|
||||
onSuccess: function(e, data) {
|
||||
|
||||
if (!data.fv.isValidField('confirm_password')) {
|
||||
data.fv.revalidateField('confirm_password');
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
confirm_password: {
|
||||
validators: {
|
||||
@ -49,17 +37,10 @@ require(["jquery", "bs_alert", "csrf", "validation"], function($, bs_alert, csrf
|
||||
message: "请填写确认密码"
|
||||
},
|
||||
confirm: {
|
||||
firstPassword: $("#new_password"),
|
||||
secondPassword: $("#confirm_password"),
|
||||
original: $("#new_password"),
|
||||
message: "两次输入的密码必须一致"
|
||||
}
|
||||
},
|
||||
onSuccess: function(e, data) {
|
||||
|
||||
if (!data.fv.isValidField('new_password')) {
|
||||
data.fv.revalidateField('new_password');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -83,8 +64,6 @@ require(["jquery", "bs_alert", "csrf", "validation"], function($, bs_alert, csrf
|
||||
bs_alert(data.data);
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
});
|
||||
|
||||
});
|
@ -1,5 +1,4 @@
|
||||
require(["jquery", "bs_alert", "csrf", "validation"], function($, bs_alert, csrfHeader){
|
||||
|
||||
$("#register-form")
|
||||
.formValidation({
|
||||
framework: "bootstrap",
|
||||
@ -28,18 +27,10 @@ require(["jquery", "bs_alert", "csrf", "validation"], function($, bs_alert, csrf
|
||||
min: 6,
|
||||
max: 30,
|
||||
message: '密码长度必须在6到30位之间'
|
||||
},
|
||||
confirm: {
|
||||
firstPassword: $("#password"),
|
||||
secondPassword: $("#confirm_password"),
|
||||
message: "两次输入的密码必须一致"
|
||||
}
|
||||
}
|
||||
},
|
||||
onSuccess: function(e, data) {
|
||||
|
||||
if (!data.fv.isValidField('confirm_password')) {
|
||||
data.fv.revalidateField('confirm_password');
|
||||
}
|
||||
}
|
||||
},
|
||||
real_name: {
|
||||
@ -48,7 +39,6 @@ require(["jquery", "bs_alert", "csrf", "validation"], function($, bs_alert, csrf
|
||||
message: "请填写真实姓名"
|
||||
}
|
||||
},
|
||||
|
||||
},
|
||||
confirm_password: {
|
||||
validators: {
|
||||
@ -56,18 +46,9 @@ require(["jquery", "bs_alert", "csrf", "validation"], function($, bs_alert, csrf
|
||||
message: "请填写确认密码"
|
||||
},
|
||||
confirm: {
|
||||
firstPassword: $("#password"),
|
||||
secondPassword: $("#confirm_password"),
|
||||
original: $("#password"),
|
||||
message: "两次输入的密码必须一致"
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
onSuccess: function(e, data) {
|
||||
|
||||
if (!data.fv.isValidField('password')) {
|
||||
data.fv.revalidateField('password');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,13 +22,11 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
FormValidation.Validator.confirm = {
|
||||
|
||||
validate: function(validator, $field, options) {
|
||||
if (options.firstPassword.val() == options.secondPassword.val() ||options.secondPassword.val()== '')
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
if (options.original.val() == $field.val() || $field.val()== '')
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}));
|
||||
|
@ -1,7 +1,6 @@
|
||||
/**
|
||||
* usernameCheck validator
|
||||
*/
|
||||
|
||||
(function(root, factory) {
|
||||
|
||||
"use strict";
|
||||
@ -13,7 +12,6 @@
|
||||
// planted over the root!
|
||||
factory(root.jQuery, root.FormValidation);
|
||||
}
|
||||
|
||||
}(this, function ($, FormValidation, csrfHeader) {
|
||||
FormValidation.I18n = $.extend(true, FormValidation.I18n || {}, {
|
||||
'en_US': {
|
||||
@ -22,23 +20,18 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
FormValidation.Validator.usernameCheck = {
|
||||
|
||||
validate: function(validator, $field, options) {
|
||||
if ($field.val() == '')
|
||||
return true;
|
||||
return !$.ajax({
|
||||
async: false,
|
||||
beforeSend: csrfHeader,
|
||||
url: "/api/username_check/",
|
||||
data: {username: $field.val()},
|
||||
dataType: "json",
|
||||
method: "post",
|
||||
|
||||
|
||||
}).responseJSON.data;
|
||||
|
||||
async: false,
|
||||
beforeSend: csrfHeader,
|
||||
url: "/api/username_check/",
|
||||
data: {username: $field.val()},
|
||||
dataType: "json",
|
||||
method: "post",
|
||||
}).responseJSON.data;
|
||||
}
|
||||
};
|
||||
}));
|
||||
|
@ -11,5 +11,4 @@ define("validation",
|
||||
'validator/confirm',
|
||||
'validator/usernameCheck'],
|
||||
function () {
|
||||
|
||||
});
|
5
tools/runserver.cmd
Normal file
5
tools/runserver.cmd
Normal file
@ -0,0 +1,5 @@
|
||||
@echo off
|
||||
python manage.py runserver
|
||||
cls
|
||||
cd..
|
||||
python manage.py runserver
|
12
tools/runtest.cmd
Normal file
12
tools/runtest.cmd
Normal file
@ -0,0 +1,12 @@
|
||||
@echo off
|
||||
coverage run --source='.' manage.py test
|
||||
coverage html
|
||||
cd htmlcov
|
||||
index.html
|
||||
cls
|
||||
cd..
|
||||
coverage run --source='.' manage.py test
|
||||
coverage html
|
||||
cd htmlcov
|
||||
index.html
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
coverage run --source='.' manage.py test
|
||||
nose html
|
||||
coverage html
|
||||
open htmlcov/index.html
|
||||
|
Loading…
Reference in New Issue
Block a user