File was renamed from src/com/gitblit/wicket/LoginPage.java |
| | |
| | | * See the License for the specific language governing permissions and
|
| | | * limitations under the License.
|
| | | */
|
| | | package com.gitblit.wicket;
|
| | | package com.gitblit.wicket.pages;
|
| | |
|
| | | import org.apache.wicket.PageParameters;
|
| | | import org.apache.wicket.markup.html.WebPage;
|
| | | import org.apache.wicket.markup.html.basic.Label;
|
| | | import org.apache.wicket.markup.html.form.Form;
|
| | | import org.apache.wicket.markup.html.form.PasswordTextField;
|
| | | import org.apache.wicket.markup.html.form.StatelessForm;
|
| | | import org.apache.wicket.markup.html.form.TextField;
|
| | |
| | | import com.gitblit.Constants;
|
| | | import com.gitblit.GitBlit;
|
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.wicket.models.UserModel;
|
| | | import com.gitblit.models.UserModel;
|
| | | import com.gitblit.wicket.GitBlitWebSession;
|
| | |
|
| | | public class LoginPage extends WebPage {
|
| | |
|
| | |
| | | public LoginPage(PageParameters params) {
|
| | | super(params);
|
| | |
|
| | | add(new Label("title", GitBlit.getString(Keys.web.siteName, Constants.NAME)));
|
| | | add(new Label("name", Constants.NAME));
|
| | |
|
| | | Form<Void> loginForm = new LoginForm("loginForm");
|
| | | loginForm.add(new TextField<String>("username", username));
|
| | | loginForm.add(new PasswordTextField("password", password));
|
| | | loginForm.add(new FeedbackPanel("feedback"));
|
| | | add(loginForm);
|
| | | }
|
| | |
|
| | | class LoginForm extends StatelessForm<Void> {
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | public LoginForm(String id) {
|
| | | super(id);
|
| | |
|
| | | // If we are already logged in because user directly accessed
|
| | | // the login url, redirect to the home page
|
| | | if (GitBlitWebSession.get().isLoggedIn()) {
|
| | | setRedirect(true);
|
| | | setResponsePage(getApplication().getHomePage());
|
| | | }
|
| | | }
|
| | | |
| | | add(new Label("title", GitBlit.getString(Keys.web.siteName, Constants.NAME)));
|
| | | add(new Label("name", Constants.NAME));
|
| | |
|
| | | StatelessForm<Void> loginForm = new StatelessForm<Void>("loginForm") {
|
| | | |
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | @Override
|
| | | public void onSubmit() {
|
| | |
| | | loginUser(user);
|
| | | }
|
| | | }
|
| | | };
|
| | | loginForm.add(new TextField<String>("username", username));
|
| | | loginForm.add(new PasswordTextField("password", password));
|
| | | loginForm.add(new FeedbackPanel("feedback"));
|
| | | add(loginForm);
|
| | | }
|
| | |
|
| | | private void loginUser(UserModel user) {
|