NIHVIVO-1393 Add button to login widget when external auth server is configured

This commit is contained in:
rjy7 2010-11-23 02:32:09 +00:00
parent ca6ab8288e
commit 60060d4752
3 changed files with 25 additions and 5 deletions

View file

@ -12,6 +12,8 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import edu.cornell.mannlib.vedit.beans.LoginStatusBean;
import edu.cornell.mannlib.vitro.webapp.ConfigurationProperties;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.Route;
import edu.cornell.mannlib.vitro.webapp.controller.login.LoginProcessBean;
import edu.cornell.mannlib.vitro.webapp.controller.login.LoginProcessBean.State;
@ -45,6 +47,8 @@ public class LoginWidget extends Widget {
FORM_ACTION("formAction"),
INFO_MESSAGE("infoMessage"),
ERROR_MESSAGE("errorMessage"),
EXTERNAL_AUTH_NAME("externalAuthName"),
EXTERNAL_AUTH_URL("externalAuthUrl"),
CANCEL_URL("cancelUrl");
private final String variableName;
@ -114,6 +118,14 @@ public class LoginWidget extends Widget {
values.put(TemplateVariable.FORM_ACTION.toString(), getAuthenticateUrl(request));
values.put(TemplateVariable.LOGIN_NAME.toString(), bean.getUsername());
String externalAuthServerUrl = ConfigurationProperties.getProperty("externalAuth.serverUrl");
externalAuthServerUrl = UrlBuilder.getUrl(externalAuthServerUrl);
if (externalAuthServerUrl != null) {
values.put(TemplateVariable.EXTERNAL_AUTH_URL.toString(), externalAuthServerUrl);
values.put(TemplateVariable.EXTERNAL_AUTH_NAME.toString(),
ConfigurationProperties.getProperty("externalAuth.serverName"));
}
String infoMessage = bean.getInfoMessage();
if (!infoMessage.isEmpty()) {
values.put(TemplateVariable.INFO_MESSAGE.toString(), infoMessage);

View file

@ -41,6 +41,10 @@ p.request-account {
float:left;
}
#log-in-form p.external-auth {
margin-left: 36px;
}
#errorAlert {
color:#900;
padding:0px;

View file

@ -44,13 +44,17 @@
<input class="text-field" name="loginPassword" id="password" type="password" required />
<p class="submit"><input name="loginForm" type="submit" class="green button" value="Log in"/></p>
<input class="checkbox-remember-me" name="remember-me" type="checkbox" value="" />
<label class="label-remember-me" for="remember-me">Remember me</label>
<p class="forgot-password"><a href="#">Forgot your password?</a></p>
<p class="request-account"><a class="blue button" href="#">Request an account</a> </p>
<#if externalAuthUrl??>
<p class="external-auth">
<a class="green button" href="${externalAuthUrl}">Log in using ${externalAuthName}</a>
</p>
</#if>
</form>
</section><!-- #log-in -->