当前位置: 首页>>代码示例>>Java>>正文


Java SessionlessForm类代码示例

本文整理汇总了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);
}
 
开发者ID:tomaswolf,项目名称:gerrit-gitblit-plugin,代码行数:37,代码来源:RootPage.java

示例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);
}
 
开发者ID:warpfork,项目名称:gitblit,代码行数:35,代码来源:RootPage.java


注:本文中的com.gitblit.wicket.SessionlessForm类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。