1818
1919<%-- Body of the login page, invoked from login.jsp --%>
2020<%@ page import =" org.apache.roller.weblogger.config.WebloggerConfig" %>
21- <%@ page import =" org.apache.roller.weblogger.config.AuthMethod" %>
2221<%@ include file =" /WEB-INF/jsps/taglibs-struts2.jsp" %>
2322
2423<%!
25- String securityCheckUrl = null ;
26- boolean cmaEnabled = " CMA" . equals(WebloggerConfig . getAuthMethod());
24+ String securityCheckUrl = null ;
25+ boolean cmaEnabled = " CMA" . equals( WebloggerConfig . getAuthMethod() );
2726% >
2827
2928<%
30- if (cmaEnabled) {
31- securityCheckUrl = " /j_security_check" ;
32- } else {
33- securityCheckUrl = " /roller_j_security_check" ;
34- }
29+ if (cmaEnabled) {
30+ securityCheckUrl = " /j_security_check" ;
31+ } else {
32+ securityCheckUrl = " /roller_j_security_check" ;
33+ }
3534% >
3635
37- <s:if test =" authMethod == 'OPENID' || authMethod == 'DB_OPENID'" >
38-
39- <p ><s:text name =" loginPage.openIdPrompt" /></p >
40-
41- <form method =" post" id =" loginOpenIDForm"
42- action =" /roller/roller_j_openid_security_check"
43- onsubmit =" saveOpenidIdentifier(this)" >
44- <!-- action="<c:url value='roller_j_openid_security_check'/>" -->
45- <table width =" 80%" >
46- <tr >
47- <td width =" 20%" align =" right" ><s:text name =" loginPage.openID" /></td >
48- <td width =" 80%" >
49- <input type =" text" name =" openid_identifier" id =" openid_identifier" class =" f_openid_identifier" size =" 40" maxlength =" 255" style =" width : 35% " />
50- </td >
51- </tr >
52- <tr >
53- <td width =" 20%" ></td >
54- <td width =" 80%" >
55- <input type =" submit" name =" submit" id =" submit" value =" <s:text name='loginPage.loginOpenID'/>" />
56- </td >
57- </tr >
58- </table >
59- </form >
60- </s:if >
61-
62- <s:if test =" authMethod != 'OPENID'" >
63-
64- <s:if test =" authMethod == 'DB_OPENID'" >
65- <p ><s:text name =" loginPage.openIdHybridPrompt" /></p >
36+ <div class =" container" >
37+
38+ <s:if test =" authMethod == 'OPENID' || authMethod == 'DB_OPENID'" >
39+
40+ <form method =" post" id =" loginOpenIDForm" class =" form-signin"
41+ action =" /roller/roller_j_openid_security_check" onsubmit =" saveOpenidIdentifier(this)" >
42+
43+ <h2 class =" form-signin-heading" ><s:text name =" loginPage.openIdPrompt" /></h2 >
44+
45+ <label for =" openid_identifier" class =" sr-only" ><s:text name =" loginPage.openID" /></label >
46+ <input class =" form-control" type =" text" name =" openid_identifier" id =" openid_identifier" />
47+
48+ <button type =" submit" name =" submit" id =" submit" class =" btn btn-lg btn-primary btn-block"
49+ value =" <s:text name='loginPage.loginOpenID'/>" ></button >
50+
51+ </form >
52+
6653 </s:if >
67-
68- <s:else >
69- <p ><s:text name =" loginPage.prompt" /></p >
70- </s:else >
71-
72- <form method =" post" id =" loginForm"
73- action =" <c:url value=" <% = securityCheckUrl % >"/>"
74- onsubmit="saveUsername(this)">
75-
76- <table width =" 80%" >
77-
78- <tr >
79- <td width =" 20%" align =" right" ><s:text name =" loginPage.userName" /></td >
80- <td width =" 80%" >
81- <input type =" text" name =" j_username" id =" j_username" size =" 25" />
82- </td >
83- </tr >
84-
85- <tr >
86- <td width =" 20%" align =" right" ><s:text name =" loginPage.password" /></td >
87- <td width =" 80%" >
88- <input type =" password" name =" j_password" id =" j_password" size =" 20" />
89- </td >
90- </tr >
54+
55+ <s:if test =" authMethod != 'OPENID'" >
56+
57+
58+ <form method =" post" id =" loginForm" class =" form-signin"
59+ action =" <c:url value=" <% = securityCheckUrl % >"/>"
60+ onsubmit="saveUsername(this)">
61+
62+ <s:if test =" authMethod == 'DB_OPENID'" >
63+ <h2 class =" form-signin-heading" ><s:text name =" loginPage.openIdHybridPrompt" /></h2 >
64+ </s:if >
65+
66+ <s:else >
67+ <h2 class =" form-signin-heading" ><s:text name =" loginPage.prompt" /></h2 >
68+ </s:else >
69+
70+ <label for =" j_username" class =" sr-only" > <s:text name =" loginPage.userName" /> </label >
71+ <input type =" text" class =" form-control" name =" j_username" id =" j_username" placeholder =" Username" />
72+
73+ <label for =" j_password" class =" sr-only" > <s:text name =" loginPage.password" /> </label >
74+ <input type =" password" class =" form-control" name =" j_password" id =" j_password" placeholder =" Password" />
9175
9276 <c:if test =" ${ rememberMeEnabled } " >
93- <tr >
94- <td width =" 20%" ></td >
95- <td width =" 80%" >
96- <input type =" checkbox" name =" _spring_security_remember_me" id =" _spring_security_remember_me" />
97- <label for =" rememberMe" >
98- <s:text name =" loginPage.rememberMe" />
99- </label >
100- </td >
101- </tr >
77+ <label >
78+ <input type =" checkbox" name =" _spring_security_remember_me" id =" _spring_security_remember_me" />
79+ <s:text name =" loginPage.rememberMe" />
80+ </label >
10281 </c:if >
10382
104- <tr >
105- <td width =" 20%" ></td >
106- <td width =" 80%" >
107- <input type =" submit" name =" login" id =" login" value =" <s:text name='loginPage.login' />" />
108- <input type =" reset" name =" reset" id =" reset" value =" <s:text name='loginPage.reset' />"
109- onclick =" document.getElementById('j_username').focus()" />
110- </td >
111- </tr >
83+ <button class =" btn btn-lg btn-primary btn-block" type =" submit" name =" login" id =" login" >
84+ <s:text name =' loginPage.login' />
85+ </button >
11286
113- </table >
114- </form >
115- </s:if >
87+ <button class =" btn btn-lg btn-primary btn-block" type =" reset" name =" reset" id =" reset"
88+ onclick =" document.getElementById('j_username').focus()" >
89+ <s:text name =' loginPage.reset' />
90+ </button >
91+
92+ </form >
93+ </s:if >
94+
95+ </div >
11696
11797<script >
118- < s: if test= " authMethod == 'OPENID' || authMethod == 'DB_OPENID'" >
119- function focusToOpenidForm () {
120- return (document .getElementById && document .getElementById (" j_username" ) === null ) ||
121- getCookie (" favorite_authentication_method" ) !== " username" ;
122- }
123-
124- if (document .getElementById ) {
125- if (document .getElementById && getCookie (" openid_identifier" ) !== null ) {
126- document .getElementById (" openid_identifier" ).value = getCookie (" openid_identifier" );
98+ < s: if test= " authMethod == 'OPENID' || authMethod == 'DB_OPENID'" >
99+ function focusToOpenidForm () {
100+ return (document .getElementById && document .getElementById (" j_username" ) === null ) ||
101+ getCookie (" favorite_authentication_method" ) !== " username" ;
102+ }
103+
104+ if (document .getElementById ) {
105+ if (document .getElementById && getCookie (" openid_identifier" ) !== null ) {
106+ document .getElementById (" openid_identifier" ).value = getCookie (" openid_identifier" );
107+ }
108+ if (focusToOpenidForm ()) {
109+ document .getElementById (" openid_identifier" ).focus ();
110+ }
127111 }
128- if (focusToOpenidForm ()) {
129- document .getElementById (" openid_identifier" ).focus ();
112+
113+ function saveOpenidIdentifier (theForm ) {
114+ var expires = new Date ();
115+ expires .setTime (expires .getTime () + 24 * 30 * 60 * 60 * 1000 ); // sets it for approx 30 days.
116+ setCookie (" openid_identifier" , theForm .openid_identifier .value , expires);
117+ setCookie (" favorite_authentication_method" , " openid" );
130118 }
131- }
132-
133- function saveOpenidIdentifier (theForm ) {
134- var expires = new Date ();
135- expires .setTime (expires .getTime () + 24 * 30 * 60 * 60 * 1000 ); // sets it for approx 30 days.
136- setCookie (" openid_identifier" ,theForm .openid_identifier .value ,expires);
137- setCookie (" favorite_authentication_method" , " openid" );
138- }
139- < / s: if >
140-
141- < s: if test= " authMethod != 'OPENID'" >
142- function focusToUsernamePasswordForm () {
143- return (document .getElementById && document .getElementById (" openid_identifier" ) === null ) ||
144- getCookie (" favorite_authentication_method" ) === " username" ;
145- }
146-
147- if (document .getElementById ) {
148- if (getCookie (" username" ) != null ) {
149- if (document .getElementById ) {
150- document .getElementById (" j_username" ).value = getCookie (" username" );
151- if (focusToUsernamePasswordForm ()) {
152- document .getElementById (" j_password" ).focus ();
119+ < / s: if >
120+
121+ < s: if test= " authMethod != 'OPENID'" >
122+ function focusToUsernamePasswordForm () {
123+ return (document .getElementById && document .getElementById (" openid_identifier" ) === null ) ||
124+ getCookie (" favorite_authentication_method" ) === " username" ;
125+ }
126+
127+ if (document .getElementById ) {
128+ if (getCookie (" username" ) != null ) {
129+ if (document .getElementById ) {
130+ document .getElementById (" j_username" ).value = getCookie (" username" );
131+ if (focusToUsernamePasswordForm ()) {
132+ document .getElementById (" j_password" ).focus ();
133+ }
153134 }
135+ } else if (focusToUsernamePasswordForm ()) {
136+ document .getElementById (" j_username" ).focus ();
154137 }
155- } else if (focusToUsernamePasswordForm ()) {
156- document .getElementById (" j_username" ).focus ();
157138 }
158- }
159-
160- function saveUsername (theForm ) {
161- var expires = new Date ();
162- expires .setTime (expires .getTime () + 24 * 30 * 60 * 60 * 1000 ); // sets it for approx 30 days.
163- setCookie (" username" ,theForm .j_username .value ,expires);
164- setCookie (" favorite_authentication_method" , " username" );
165- }
166- < / s: if >
139+
140+ function saveUsername (theForm ) {
141+ var expires = new Date ();
142+ expires .setTime (expires .getTime () + 24 * 30 * 60 * 60 * 1000 ); // sets it for approx 30 days.
143+ setCookie (" username" , theForm .j_username .value , expires);
144+ setCookie (" favorite_authentication_method" , " username" );
145+ }
146+ < / s: if >
167147 </script >
0 commit comments