1+ <!DOCTYPE html>
2+ <%@ page contentType =" text/html;charset=UTF-8" language =" java" %>
3+ <%@ taglib prefix =" c" uri =" http://java.sun.com/jsp/jstl/core" %>
4+ <%@ taglib prefix =" form" uri =" http://www.springframework.org/tags/form" %>
5+ <%@ taglib prefix =" spring" uri =" http://www.springframework.org/tags" %>
6+ <%@ taglib prefix =" sec"
7+ uri =" http://www.springframework.org/security/tags" %>
8+ <%@ page session =" false" %>
9+ <html >
10+ <head >
11+ <link rel =" stylesheet" href =" https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" >
12+ <meta http-equiv =" Content-Type" content =" text/html; charset=US-ASCII" >
13+ <title ><spring:message code =" message.changePassword" ></spring:message ></title >
14+ </head >
15+ <body >
16+ <nav class =" navbar navbar-default" >
17+ <div class =" container-fluid" >
18+ <div class =" navbar-header" >
19+ <a class =" navbar-brand" href =" #" ><spring:message code =" label.pages.home.title" ></spring:message ></a >
20+ </div >
21+ <ul class =" nav navbar-nav navbar-right" >
22+ <li ><a href =" <c:url value=" /j_spring_security_logout " />" ><spring:message code =" label.pages.logout" ></spring:message ></a > </li >
23+ </ul >
24+ </div >
25+ </nav >
26+ <div class =" container" >
27+ <div class =" row" >
28+ <div id =" errormsg" class =" alert alert-danger" style =" display :none " ></div >
29+ <h1 > <spring:message code =" message.changePassword" ></spring:message > </h1 >
30+ <div >
31+ <br >
32+
33+ <label class =" col-sm-2" ><spring:message code =" label.user.oldPassword" ></spring:message ></label >
34+ <span class =" col-sm-5" ><input class =" form-control" id =" oldpass" name =" oldpassword" type =" password" value =" " /></span >
35+ <span class =" col-sm-5" ></span >
36+ <br ><br >
37+ <label class =" col-sm-2" ><spring:message code =" label.user.newPassword" ></spring:message ></label >
38+ <span class =" col-sm-5" ><input class =" form-control" id =" pass" name =" password" type =" password" value =" " /></span >
39+ <span class =" col-sm-5" ></span >
40+ <br ><br >
41+ <label class =" col-sm-2" ><spring:message code =" label.user.confirmPass" ></spring:message ></label >
42+ <span class =" col-sm-5" ><input class =" form-control" id =" passConfirm" type =" password" value =" " /></span >
43+ <span id =" error" class =" alert alert-danger" style =" display :none " ><spring:message code =" PasswordMatches.user" ></spring:message ></span >
44+
45+ <br ><br >
46+ <button class =" btn btn-primary" type =" submit" onclick =" savePass()" >
47+ <spring:message code =" message.changePassword" ></spring:message >
48+ </button >
49+ </div >
50+
51+ </div >
52+ </div >
53+ <script src =" http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js" ></script >
54+ <script type =" text/javascript" >
55+ function savePass (){
56+ var pass = $ (" #pass" ).val ();
57+ var valid = pass == $ (" #passConfirm" ).val ();
58+ if (! valid) {
59+ $ (" #error" ).show ();
60+ return ;
61+ }
62+ $ .post (" <c:url value=" / user/ updatePassword" ></c:url>" ,{password: pass, oldpassword: $ (" #oldpass" ).val ()} ,function (data ){
63+ window .location .href = " <c:url value=" / console .html " ></c:url>" + " ?message=" + data .message ;
64+ })
65+ .fail (function (data ) {
66+ $ (" #errormsg" ).show ().html (data .responseJSON .message );
67+ });
68+ }
69+ </script >
70+ </body >
71+
72+ </html >
0 commit comments