NIHVIVO-1393 Add button to login widget when external auth server is configured
This commit is contained in:
parent
ca6ab8288e
commit
60060d4752
3 changed files with 25 additions and 5 deletions
|
@ -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;
|
||||
|
@ -113,6 +117,14 @@ public class LoginWidget extends Widget {
|
|||
WidgetTemplateValues values = new WidgetTemplateValues(Macro.LOGIN.toString());
|
||||
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()) {
|
||||
|
|
|
@ -41,6 +41,10 @@ p.request-account {
|
|||
float:left;
|
||||
}
|
||||
|
||||
#log-in-form p.external-auth {
|
||||
margin-left: 36px;
|
||||
}
|
||||
|
||||
#errorAlert {
|
||||
color:#900;
|
||||
padding:0px;
|
||||
|
|
|
@ -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>
|
||||
<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 -->
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue