Skip to content

Instantly share code, notes, and snippets.

@wdfx100
Created April 17, 2013 10:01
Show Gist options
  • Save wdfx100/5403169 to your computer and use it in GitHub Desktop.
Save wdfx100/5403169 to your computer and use it in GitHub Desktop.
#加密#
jar
commons-codec-1.6.jar
sha.js
<form action="login" method="post" class="formgo">
<c:choose>
<c:when test="${param.error=='1001' }">
<p>用户名或密码错误 </p>
</c:when>
<c:when test="${param.error=='1002' }">
<p>账户禁用 </p>
</c:when>
<c:when test="${param.error=='1003' }">
<p>请先登录</p>
</c:when>
</c:choose>
用户名:<input type="text" name="username" /><br>
密码:<input type="password" name="pwd" /><br>
<button type="button" id="go">进入系统</button>
</form>
<script type="text/javascript" src="/static/js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="/static/js/sha.js"></script>
<script type="text/javascript">
$(function(){
$("#go").click(function(){
var pwd = $("input[type='password']").val();
var sha = CryptoJS.SHA1(pwd);
$("input[type='password']").val(sha);
$(".formgo").submit();
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment