The widget is already available in the appstore, named 'LoginButton'
I just got this to work today in one of my projects. Here are the steps I took:
Download the Login Button app from the app store.
Create a dummy form in your project with a table, and insert the widget into that table. Make sure to set the required widget properties (User Entity).
Now launch your project and use Firebug (Firefox development add-on) to inspect the HTML code generated by the Login Button widget.
Copy the DIV that was generated by the widget into your index.html (somewhere within the MainBox DIV). In my project it looks like this:
Now re-load your portal page and voila! It should work.
Cheers.
In 2.5 will be a widget available for that purpose.
How can I display it in the header of every page ,I think there is a way to put it in the index.html page ,how?
To show this widget in your theme, just add the div to your index.html, see this post