On Mon, Dec 26, 2005 at 09:21:21AM +0100, Andrew Kendall
wrote:> I''m using salted login generator and would like my pages to
display a
> login status bar.
>
> If the user is logged in I want it to show something like:
>
> ---------------------------------------------------------------
> You are currently logged in as UserX (Logout)
> ---------------------------------------------------------------
>
> And if they''re not logged in:
>
> ---------------------------------------------------------------
> Login/Signup
> ---------------------------------------------------------------
>
>
> Any ideas?
after user authenticated store ''User'' in the session -
on the template it could go like:
<%= link_to_unless( @session[:user].nil?, ''logout'', {
:controller => ''foo'', :action =>
''logout'' } %>
<%= link_to_unless( @session[:user], ''login'', {
:controller => ''foo'', :action =>
''login'' } %>
or if u prefer more lines:
<% if @session[:user] %>
currently logged in as <%= @session[:user].login %>
<%= link_to ''logout'', :action =>
''logout'' %>
<% else %>
not logged in <%= link_to ''login'', :action =>
''login'' %>
<% end %>
but i guess u would have found out yourself...
regards
rene