I want to add some JavaScript validations in existing JavaScript validations when user changes his password.
Now, I want to use AJAX to connect with PHP file which runs db query against the current user and check whether the entered password in new_password field is matches with his last 10 passwords.
Now, I found out those function which SugarCRM uses to match passwords with the hashed passwords stored in database. But, the problem is I don't know how to use AJAX to connect to PHP file in SugarCRM.
I want to add JavaScript validation using onblur function. When user enter his new password, using onblur, I want to send that password value to PHP file using AJAX and return that value. And when user click save button, it should give alert box if his new password matches with his last passwords and if not it should allow him to change his password.
Can anyone here guide me soon? Any help is appreciated.
如何防止用户使用sugarcrm中的ajax在新密码字段中输入以前的密码?
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
2条回答 默认 最新
doudui9516 2015-02-10 09:24关注I have managed to find the answer as I want. I am sharing my code with you all.
if(form.new_password.value!=''){ $.ajax({ url:'index.php?entryPoint=check_last_passwords', data:{new_password: $('#new_password').val(), record: $('#record').val()}, success: function(data){ if(data!=''){ alert("Error: New password should not match with the last 10 passwords."); return false; }else{ var _form = $('#EditView')[0]; if (!Admin_check()) return false; _form.action.value='Save'; set_chooser(); if(verify_data(EditView)) _form.submit(); } } }); }本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报