CCM NG: Some work on the login form.
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@3848 8810af33-2d31-482b-a856-94f89814c4dfpull/2/head
parent
22dd841c11
commit
d6114efcf7
|
|
@ -53,8 +53,13 @@ import com.arsdigita.web.ParameterMap;
|
|||
import com.arsdigita.web.RedirectSignal;
|
||||
import com.arsdigita.web.ReturnSignal;
|
||||
import com.arsdigita.web.URL;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.enterprise.context.spi.CreationalContext;
|
||||
import javax.enterprise.inject.spi.Bean;
|
||||
import javax.enterprise.inject.spi.BeanManager;
|
||||
|
|
@ -62,7 +67,6 @@ import javax.enterprise.inject.spi.CDI;
|
|||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.shiro.authc.AuthenticationException;
|
||||
import org.apache.shiro.authc.UsernamePasswordToken;
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
|
|
@ -98,7 +102,8 @@ public class UserLoginForm extends Form implements LoginConstants,
|
|||
FormValidationListener,
|
||||
FormProcessListener {
|
||||
|
||||
private static final Logger s_log = Logger.getLogger(UserLoginForm.class);
|
||||
private static final Logger LOGGER = LogManager.getLogger(
|
||||
UserLoginForm.class);
|
||||
|
||||
// package friendly static form name makes writing HttpUnitTest easier
|
||||
final static String FORM_NAME = "user-login";
|
||||
|
|
@ -145,8 +150,9 @@ public class UserLoginForm extends Form implements LoginConstants,
|
|||
final ConfigurationManager confManager;
|
||||
if (iterator.hasNext()) {
|
||||
@SuppressWarnings("unchecked")
|
||||
final Bean<ConfigurationManager> bean = (Bean<ConfigurationManager>) iterator.
|
||||
next();
|
||||
final Bean<ConfigurationManager> bean
|
||||
= (Bean<ConfigurationManager>) iterator
|
||||
.next();
|
||||
final CreationalContext<ConfigurationManager> ctx = beanManager.
|
||||
createCreationalContext(bean);
|
||||
|
||||
|
|
@ -262,13 +268,13 @@ public class UserLoginForm extends Form implements LoginConstants,
|
|||
@Override
|
||||
public void init(FormSectionEvent event)
|
||||
throws FormProcessException {
|
||||
s_log.info("In init");
|
||||
LOGGER.info("In init");
|
||||
|
||||
final KernelConfig kernelConfig = KernelConfig.getConfig();
|
||||
|
||||
if (kernelConfig.isSsoEnabled()) {
|
||||
// try SSO login
|
||||
s_log.info("trying SSO");
|
||||
LOGGER.info("trying SSO");
|
||||
// try {
|
||||
throw new UnsupportedOperationException(
|
||||
"SSO currently not supported");
|
||||
|
|
@ -304,7 +310,7 @@ public class UserLoginForm extends Form implements LoginConstants,
|
|||
public void validate(FormSectionEvent event)
|
||||
throws FormProcessException {
|
||||
|
||||
s_log.debug("In validate");
|
||||
LOGGER.debug("In validate");
|
||||
|
||||
FormData data = event.getFormData();
|
||||
PageState state = event.getPageState();
|
||||
|
|
@ -342,7 +348,7 @@ public class UserLoginForm extends Form implements LoginConstants,
|
|||
@Override
|
||||
public void process(final FormSectionEvent event)
|
||||
throws FormProcessException {
|
||||
s_log.debug("In process");
|
||||
LOGGER.debug("In process");
|
||||
|
||||
final PageState state = event.getPageState();
|
||||
final HttpServletRequest req = state.getRequest();
|
||||
|
|
@ -374,7 +380,7 @@ public class UserLoginForm extends Form implements LoginConstants,
|
|||
final Subject subject = cdiUtil.findBean(Subject.class);
|
||||
|
||||
final UsernamePasswordToken token = new UsernamePasswordToken(
|
||||
(String) m_loginName.getValue(state),
|
||||
m_loginName.getValue(state).toString(),
|
||||
(String) m_password.getValue(state)
|
||||
);
|
||||
token.setRememberMe(getPersistentLoginValue(state, false));
|
||||
|
|
@ -383,6 +389,8 @@ public class UserLoginForm extends Form implements LoginConstants,
|
|||
} catch (AuthenticationException ex) {
|
||||
onLoginFail(event, ex);
|
||||
}
|
||||
|
||||
LOGGER.debug("User {} logged in successfully.", token.getUsername());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -424,7 +432,7 @@ public class UserLoginForm extends Form implements LoginConstants,
|
|||
protected void onLoginFail(final FormSectionEvent event,
|
||||
final AuthenticationException ex)
|
||||
throws FormProcessException {
|
||||
s_log.debug("Login fail");
|
||||
LOGGER.debug("Login fail");
|
||||
event.getFormData().addError(ERROR_LOGIN_FAIL);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,8 +41,9 @@ public class SystemUsersSetup {
|
|||
private static final Logger LOGGER = LogManager.getLogger(
|
||||
SystemUsersSetup.class);
|
||||
|
||||
//Default password is "libreccm"
|
||||
private static final String DEFAULT_ADMIN_PW
|
||||
= "$shiro1$SHA-512$500000$MFPkVikNoRrBZ8R8CxQIHA==$UvgO2K+poSRGw5co63P3ygpWsX7H9N0TgqdrZPBqdXv6Q+/OCL/qOocVbg65/Yjv5hyri6A3zhw7K8mEgpISoA==";
|
||||
= "$shiro1$SHA-512$500000$MFPkVikNoRrBZ8R8CxQIHA==$ybEECtSPukmXDbV27a3LnWktFsh9lQl2ZYqCUtV0NF9G35Rt0+Tzp1msNLBQUVv15SrsdFgBSfhgWfZFyTva+Q==";
|
||||
|
||||
private final EntityManager entityManager;
|
||||
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ processor, some are read from the configuration files of Foundry and some are de
|
|||
</foundry:doc-desc>
|
||||
</foundry:doc>
|
||||
<xsl:param name="theme-prefix"
|
||||
select="concat($context-prefix, 'themes/libreccm-default/')"/>
|
||||
select="concat($context-prefix, '/themes/libreccm-default')"/>
|
||||
|
||||
<foundry:doc section="devel" type="env-var">
|
||||
<foundry:doc-desc>
|
||||
|
|
|
|||
|
|
@ -17,6 +17,6 @@
|
|||
|
||||
<setting id="log-level">warn</setting>
|
||||
|
||||
<setting id="site-logo">images/cms-logo.png</setting>
|
||||
<setting id="site-logo">images/libreccm.png</setting>
|
||||
|
||||
</foundry:configuration>
|
||||
Loading…
Reference in New Issue