Created
March 29, 2017 02:48
-
-
Save pvlasov/567540e998226b0ffce6543700fdafe7 to your computer and use it in GitHub Desktop.
Guest getIndexHtml() method processing login
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RouteMethod( | |
path="index.html", | |
value = { RequestMethod.GET, RequestMethod.POST }, | |
lock = @RouteMethod.Lock(type = Type.READ, path = ".."), | |
comment="Renders login form on GET, processes it on POST") | |
public Object indexHtml( | |
@ContextParameter CDOTransactionHttpServletRequestContext<LoginPasswordCredentials> context, | |
@TargetParameter Guest target, | |
@QueryParameter("url") String returnURL, | |
@QueryParameter("login") String login, | |
@QueryParameter("password") String password) throws Exception { | |
Form loginForm = processLogin(context, returnURL, login, password); | |
if (loginForm == null) { | |
return Action.NOP; | |
} | |
loginForm | |
.action("index.html") | |
.method(Method.post) | |
.bootstrap().grid().col(Bootstrap.DeviceSize.EXTRA_SMALL, 12) | |
.bootstrap().grid().col(Bootstrap.DeviceSize.SMALL, 12) | |
.bootstrap().grid().col(Bootstrap.DeviceSize.MEDIUM, 9) | |
.bootstrap().grid().col(Bootstrap.DeviceSize.LARGE, 7); | |
HTMLFactory htmlFactory = getHTMLFactory(context); | |
Fragment content = htmlFactory.fragment(); | |
content.content(content.getFactory().tag(TagName.h3, getResourceString(context, "logIn"))); | |
content.content(loginForm); | |
return renderPage(context, target, getResourceString(context, "logIn"), content, env -> env.remove(PageTemplateTokens.LEFT_PANEL.literal)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment