找回密码和注册用户敏感信息加密处理

This commit is contained in:
thinkgem
2020-09-29 16:07:38 +08:00
parent ac4c092a1c
commit 5e346c6d72
9 changed files with 81 additions and 32 deletions

View File

@@ -371,7 +371,7 @@ shiro:
# accessControlAllowOrigin: http://demo.jeesite.com
# accessControlAllowOrigin: '*'
# 允许跨域访问时 CORS可以使用的方法和响应
# 允许跨域访问时 CORS可以使用的方法和
# accessControlAllowMethods: GET, POST, OPTIONS
# accessControlAllowHeaders: Origin, No-Cache, X-Requested-With, If-Modified-Since, Pragma, Last-Modified, Cache-Control, Expires, Content-Type, X-E4M-With

View File

@@ -75,7 +75,24 @@ $(function(){
$('#forgetForm').validate({
ignore: ":hidden",
submitHandler: function(form) {
js.ajaxSubmitForm($(form), function(data){
var $form = $(form),
action = $form.attr('action'),
data = $form.serializeArray(),
key = window.secretKey||$('#loginKey').data('key');
if (key != ''){
for (var i=0, l=data.length; i<l; i++){
if (data[i].name == 'pwdQuestionAnswer'){
data[i].value = DesUtils.encode($('#fp_pwdQuestionAnswer').val(), key);
}else if (data[i].name == 'pwdQuestionAnswer2'){
data[i].value = DesUtils.encode($('#fp_pwdQuestionAnswer2').val(), key);
}else if (data[i].name == 'pwdQuestionAnswer3'){
data[i].value = DesUtils.encode($('#fp_pwdQuestionAnswer3').val(), key);
}else if (data[i].name == 'password'){
data[i].value = DesUtils.encode($('#fp_password').val(), key);
}
}
}
js.ajaxSubmit(action, data, function(data, status, xhr){
if (data.result == "true"){
alert(data.message);
location = ctx + '/login';

View File

@@ -67,7 +67,18 @@ $(function(){
$('#registerForm').validate({
ignore: ":hidden",
submitHandler: function(form) {
js.ajaxSubmitForm($(form), function(data){
var $form = $(form),
action = $form.attr('action'),
data = $form.serializeArray(),
key = window.secretKey||$('#loginKey').data('key');
if (key != ''){
for (var i=0, l=data.length; i<l; i++){
if (data[i].name == 'password'){
data[i].value = DesUtils.encode($('#reg_password').val(), key);
}
}
}
js.ajaxSubmit(action, data, function(data, status, xhr){
if (data.result == "true"){
alert(data.message);
location = ctx + '/login';

View File

@@ -41,24 +41,24 @@
</div>
<div class="form-group has-feedback fp-element fp-question">
<span class="fa fa-question-circle form-control-feedback"></span>
<input type="text" name="pwdQuestionAnswer" class="form-control required"
data-msg-required="请填写答案1." placeholder="答案1 " />
<input type="text" id="fp_pwdQuestionAnswer" name="pwdQuestionAnswer"
class="form-control required" data-msg-required="请填写答案1." placeholder="答案1 " />
</div>
<div class="form-group has-feedback fp-element fp-question">
问题2<span id="fp_q2"></span>
</div>
<div class="form-group has-feedback fp-element fp-question">
<span class="fa fa-question-circle form-control-feedback"></span>
<input type="text" name="pwdQuestionAnswer2" class="form-control required"
data-msg-required="请填写答案2." placeholder="答案2" />
<input type="text" id="fp_pwdQuestionAnswer2" name="pwdQuestionAnswer2"
class="form-control required" data-msg-required="请填写答案2." placeholder="答案2" />
</div>
<div class="form-group has-feedback fp-element fp-question">
问题3<span id="fp_q3"></span>
</div>
<div class="form-group has-feedback fp-element fp-question">
<span class="fa fa-question-circle form-control-feedback"></span>
<input type="text" name="pwdQuestionAnswer3" class="form-control required"
data-msg-required="请填写答案3." placeholder="答案3" />
<input type="text" id="fp_pwdQuestionAnswer3" name="pwdQuestionAnswer3"
class="form-control required" data-msg-required="请填写答案3." placeholder="答案3" />
</div>
<div class="form-group has-feedback clearfix">
<strong>设置新密码:</strong>
@@ -93,11 +93,11 @@
</div>
<div class="login-copyright">
&copy; ${@DateUtils.getYear()} ${@Global.getConfig('productName')} - Powered By <a
href="http://jeesite.com">JeeSite ${@Global.getProperty('jeesiteVersion')}</a>
id="loginKey" data-key="${@Global.getConfig('shiro.loginSubmit.secretKey')}"
href="http://jeesite.com" >JeeSite ${@Global.getProperty('jeesiteVersion')}</a>
</div>
</div>
<% } %>
<script>var secretKey = '${@Global.getConfig("shiro.loginSubmit.secretKey")}';</script>
<script src="${ctxStatic}/jquery-toastr/2.1/toastr.min.js?${_version}"></script>
<script src="${ctxStatic}/common/des.js?${_version}"></script>
<script src="${ctxStatic}/jquery-toastr/2.1/toastr.min.js?${_version}"></script>
<script src="${ctxStatic}/modules/sys/forgetPwd.js?${_version}"></script>

View File

@@ -89,9 +89,11 @@
</div>
<div class="login-copyright">
&copy; ${@DateUtils.getYear()} ${@Global.getConfig('productName')} - Powered By <a
href="http://jeesite.com">JeeSite ${@Global.getProperty('jeesiteVersion')}</a>
id="loginKey" data-key="${@Global.getConfig('shiro.loginSubmit.secretKey')}"
href="http://jeesite.com" >JeeSite ${@Global.getProperty('jeesiteVersion')}</a>
</div>
</div>
<% } %>
<script src="${ctxStatic}/common/des.js?${_version}"></script>
<script src="${ctxStatic}/jquery-toastr/2.1/toastr.min.js?${_version}"></script>
<script src="${ctxStatic}/modules/sys/registerUser.js?${_version}"></script>

View File

@@ -311,16 +311,22 @@ $('#sex input').on('ifCreated ifChecked', function(){
$("#newPassword").strength();
$("#inputFormPwd").validate({
submitHandler: function(form){
var oldPassword = $('#oldPassword').val(),
newPassword = $('#newPassword').val(),
confirmNewPassword = $('#confirmNewPassword').val(),
secretKey = '${@Global.getConfig("shiro.loginSubmit.secretKey")}';
if (secretKey != ''){
$('#oldPassword').val(DesUtils.encode(oldPassword, secretKey));
$('#newPassword').val(DesUtils.encode(newPassword, secretKey));
$('#confirmNewPassword').val(DesUtils.encode(confirmNewPassword, secretKey));
var $form = $(form),
action = $form.attr('action'),
data = $form.serializeArray(),
key = '${@Global.getConfig("shiro.loginSubmit.secretKey")}';
if (key != ''){
for (var i=0, l=data.length; i<l; i++){
if (data[i].name == 'oldPassword'){
data[i].value = DesUtils.encode($('#oldPassword').val(), key);
}else if (data[i].name == 'newPassword'){
data[i].value = DesUtils.encode($('#newPassword').val(), key);
}else if (data[i].name == 'confirmNewPassword'){
data[i].value = DesUtils.encode($('#confirmNewPassword').val(), key);
}
}
}
js.ajaxSubmitForm($(form), function(data){
js.ajaxSubmit(action, data, function(data, status, xhr){
js.showMessage(data.message);
if(data.result == Global.TRUE){
if ('${parameter.url}'!=''){
@@ -330,9 +336,6 @@ $("#inputFormPwd").validate({
}
}
}, "json");
$('#oldPassword').val(oldPassword);
$('#newPassword').val(newPassword);
$('#confirmNewPassword').val(confirmNewPassword);
}
});
// 密保问题