Search in sources :

Example 1 with LocalUserCredential

use of org.codelibs.fess.app.web.base.login.LocalUserCredential in project fess by codelibs.

the class LoginAction method login.

@Execute
public HtmlResponse login(final LoginForm form) {
    validate(form, messages -> {
    }, () -> asIndexPage(form));
    verifyToken(() -> asIndexPage(form));
    final String username = form.username;
    final String password = form.password;
    form.clearSecurityInfo();
    try {
        final HtmlResponse loginRedirect = fessLoginAssist.loginRedirect(new LocalUserCredential(username, password), op -> {
        }, () -> {
            activityHelper.login(getUserBean());
            userInfoHelper.deleteUserCodeFromCookie(request);
            return getHtmlResponse();
        });
        if (ComponentUtil.getFessConfig().isValidAdminPassword(password)) {
            return loginRedirect;
        }
        getSession().ifPresent(session -> session.setAttribute(INVALID_OLD_PASSWORD, password));
        return asHtml(virtualHost(path_Login_NewpasswordJsp));
    } catch (final LoginFailureException lfe) {
        activityHelper.loginFailure(OptionalThing.of(new LocalUserCredential(username, password)));
        throwValidationError(messages -> messages.addErrorsLoginError(GLOBAL), () -> asIndexPage(form));
    }
    return redirect(getClass());
}
Also used : HtmlResponse(org.lastaflute.web.response.HtmlResponse) HttpSession(javax.servlet.http.HttpSession) OptionalEntity(org.dbflute.optional.OptionalEntity) OptionalThing(org.dbflute.optional.OptionalThing) Resource(javax.annotation.Resource) StringUtil(org.codelibs.core.lang.StringUtil) VaErrorHook(org.lastaflute.web.validation.VaErrorHook) UserService(org.codelibs.fess.app.service.UserService) LoginFailureException(org.lastaflute.web.login.exception.LoginFailureException) LocalUserCredential(org.codelibs.fess.app.web.base.login.LocalUserCredential) RenderDataUtil(org.codelibs.fess.util.RenderDataUtil) FessUserBean(org.codelibs.fess.mylasta.action.FessUserBean) FessLoginAction(org.codelibs.fess.app.web.base.FessLoginAction) ProfileAction(org.codelibs.fess.app.web.profile.ProfileAction) Logger(org.apache.logging.log4j.Logger) ComponentUtil(org.codelibs.fess.util.ComponentUtil) Execute(org.lastaflute.web.Execute) HtmlResponse(org.lastaflute.web.response.HtmlResponse) LogManager(org.apache.logging.log4j.LogManager) LoginFailureException(org.lastaflute.web.login.exception.LoginFailureException) LocalUserCredential(org.codelibs.fess.app.web.base.login.LocalUserCredential) Execute(org.lastaflute.web.Execute)

Aggregations

Resource (javax.annotation.Resource)1 HttpSession (javax.servlet.http.HttpSession)1 LogManager (org.apache.logging.log4j.LogManager)1 Logger (org.apache.logging.log4j.Logger)1 StringUtil (org.codelibs.core.lang.StringUtil)1 UserService (org.codelibs.fess.app.service.UserService)1 FessLoginAction (org.codelibs.fess.app.web.base.FessLoginAction)1 LocalUserCredential (org.codelibs.fess.app.web.base.login.LocalUserCredential)1 ProfileAction (org.codelibs.fess.app.web.profile.ProfileAction)1 FessUserBean (org.codelibs.fess.mylasta.action.FessUserBean)1 ComponentUtil (org.codelibs.fess.util.ComponentUtil)1 RenderDataUtil (org.codelibs.fess.util.RenderDataUtil)1 OptionalEntity (org.dbflute.optional.OptionalEntity)1 OptionalThing (org.dbflute.optional.OptionalThing)1 Execute (org.lastaflute.web.Execute)1 LoginFailureException (org.lastaflute.web.login.exception.LoginFailureException)1 HtmlResponse (org.lastaflute.web.response.HtmlResponse)1 VaErrorHook (org.lastaflute.web.validation.VaErrorHook)1