[noob] How to swap top login box for Welcome NAME message?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[noob] How to swap top login box for Welcome NAME message?

mrblobby
Just like every site on the planet, we want to have a permanent username/password login box in the top right of the page header.  This should be on all pages.

However, if you actually use it and login, it needs to show "Welcome Mr. Blobby, Blanace is £123" or similar and a link to logout in the same place on every page (and change the navigation to include myaccount, but thats another problem).

I cant find any exmples of this in the wicket examples site, nor in the Pro Wicket book.  Is it possible?  What is the general strategy for this?

The problem with wicket, is ifyou have the markup in the html, and not in the code, or visa versa, the page wont work, so its kind of one or the other.

The only way I can see to do it at the moment, is to duplicate every webpage and java file, and have one with the login markup, and one with the logged in markup, but this is untennable.

I have been experimenting with having a base page class, which has code for both login form and welcome panel, a web page with the markup for both panels, and some hacky javascript that tries to render the appropriate div invisible, but havent got this to work.

Thanks for any help!
Reply | Threaded
Open this post in threaded view
|

Re: [noob] How to swap top login box for Welcome NAME message?

mrblobby
Ive got something working by putting both the login form and the Welcome XXX your balance is YYY + logout form into the header.  This looks pretty crazy in dreamweaver, but then I can switch the visibility such that only one is visible for the user by testing the myWebSession.isSignedIn().



Reply | Threaded
Open this post in threaded view
|

Re: [noob] How to swap top login box for Welcome NAME message?

jcgarciam
Hi,

1st, create a LoginPanel and LoggedUserWelcomePanel components and in your Home page you should have initially:


   <div wicket:id="loginAndLoggedPanel">
     Here will go the Login Panel and after user logs in will replace this content with the LoggedUserWelcomePanel component 
  </div>

On your code once the user is logged you can:

--onClick code  after a successful login and knowing before hand you have a reference to the loginAndLoggedPanel instance --

Panel loggedUserPanel = new LoggedUserWelcomePanel(yourUserModel);
loginAndLoggedPanel.replaceWith(
loggedUserPanel);


On Tue, Dec 14, 2010 at 4:10 PM, mrblobby [via Apache Wicket] <[hidden email]> wrote:
Ive got something working by putting both the login form and the Welcome XXX your balance is YYY + logout form into the header.  This looks pretty crazy in dreamweaver, but then I can switch the visibility such that only one is visible for the user by testing the myWebSession.isSignedIn().






View message @ http://apache-wicket.1842946.n4.nabble.com/noob-How-to-swap-top-login-box-for-Welcome-NAME-message-tp3087437p3087762.html

To start a new topic under Apache Wicket, email [hidden email]
To unsubscribe from Apache Wicket, click here.



--
Sincerely,
JC (http://www.linkedin.com/in/jcgarciam)
--Anyone who has never made a mistake has never tried anything new.--