01: /*
02: * $Id: SignIn.java 460265 2006-04-16 13:36:52Z jdonnerstag $ $Revision: 460265 $ $Date:
03: * 2005-03-25 17:29:01 +0100 (Fr, 25 Mrz 2005) $
04: *
05: * ==================================================================== Licensed
06: * under the Apache License, Version 2.0 (the "License"); you may not use this
07: * file except in compliance with the License. You may obtain a copy of the
08: * License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15: * License for the specific language governing permissions and limitations under
16: * the License.
17: */
18: package wicket.examples.library;
19:
20: import wicket.PageParameters;
21: import wicket.examples.WicketExamplePage;
22: import wicket.examples.panels.signin.SignInPanel;
23:
24: /**
25: * Simple example of a sign in page.
26: *
27: * @author Jonathan Locke
28: */
29: public final class SignIn extends WicketExamplePage {
30: /**
31: * Constructor
32: *
33: * @param parameters
34: * The page parameters
35: */
36: public SignIn(final PageParameters parameters) {
37: add(new SignInPanel("signInPanel") {
38: public boolean signIn(final String username,
39: final String password) {
40: // Sign the user in
41: final User user = ((LibrarySession) getSession())
42: .authenticate(username, password);
43:
44: // If the user was signed in
45: if (user != null) {
46: return true;
47: } else {
48: error(getLocalizer().getString(
49: "couldNotAuthenticate", this ));
50: return false;
51: }
52: }
53: });
54: }
55:
56: /**
57: * Constructor
58: */
59: public SignIn() {
60: this (null);
61: }
62: }
63:
64: //
|