本文整理汇总了Java中com.gitblit.wicket.SessionlessForm类的典型用法代码示例。如果您正苦于以下问题:Java SessionlessForm类的具体用法?Java SessionlessForm怎么用?Java SessionlessForm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SessionlessForm类属于com.gitblit.wicket包,在下文中一共展示了SessionlessForm类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: LoginForm
import com.gitblit.wicket.SessionlessForm; //导入依赖的package包/类
public LoginForm(String id, String markupId, MarkupContainer markupProvider) {
super(id, markupId, markupProvider);
setRenderBodyOnly(true);
SessionlessForm<Void> loginForm = new SessionlessForm<Void>("loginForm", RootPage.this.getClass(), getPageParameters()) {
private static final long serialVersionUID = 1L;
@Override
public void onSubmit() {
String username = RootPage.this.username.getObject();
char[] password = RootPage.this.password.getObject().toCharArray();
HttpServletRequest request = ((WebRequest) RequestCycle.get().getRequest()).getHttpServletRequest();
UserModel user = app().authentication().authenticate(username, password, request.getRemoteAddr());
if (user == null) {
error(getString("gb.invalidUsernameOrPassword"));
} else if (user.username.equals(Constants.FEDERATION_USER)) {
// disallow the federation user from logging in via the
// web ui
error(getString("gb.invalidUsernameOrPassword"));
user = null;
} else {
loginUser(user);
}
}
};
TextField<String> unameField = new TextField<String>("username", username);
WicketUtils.setInputPlaceholder(unameField, markupProvider.getString("gb.username"));
loginForm.add(unameField);
NonTrimmedPasswordTextField pwField = new NonTrimmedPasswordTextField("password", password);
WicketUtils.setInputPlaceholder(pwField, markupProvider.getString("gb.password"));
loginForm.add(pwField);
add(loginForm);
}
示例2: LoginForm
import com.gitblit.wicket.SessionlessForm; //导入依赖的package包/类
public LoginForm(String id, String markupId, MarkupContainer markupProvider) {
super(id, markupId, markupProvider);
setRenderBodyOnly(true);
SessionlessForm<Void> loginForm = new SessionlessForm<Void>("loginForm", RootPage.this.getClass(), getPageParameters()) {
private static final long serialVersionUID = 1L;
@Override
public void onSubmit() {
String username = RootPage.this.username.getObject();
char[] password = RootPage.this.password.getObject().toCharArray();
UserModel user = GitBlit.self().authenticate(username, password);
if (user == null) {
error(getString("gb.invalidUsernameOrPassword"));
} else if (user.username.equals(Constants.FEDERATION_USER)) {
// disallow the federation user from logging in via the
// web ui
error(getString("gb.invalidUsernameOrPassword"));
user = null;
} else {
loginUser(user);
}
}
};
TextField<String> unameField = new TextField<String>("username", username);
WicketUtils.setInputPlaceholder(unameField, markupProvider.getString("gb.username"));
loginForm.add(unameField);
PasswordTextField pwField = new PasswordTextField("password", password);
WicketUtils.setInputPlaceholder(pwField, markupProvider.getString("gb.password"));
loginForm.add(pwField);
add(loginForm);
}