1:- module(identity_ui, [
    2	      login_link//1
    3	  ]).

Widgets for registering, logging in, and so on

*/

    8:- use_module(weblog(identity/identity)).
 login_link(+Generator:callable)// is det
Creates a small link that says login or logout and links to a separate identity management page

*/

   17login_link(Generator) -->
   18	logged_in_as(Generator, Name, _Role),
   19	{
   20           call(Generator, show_name),
   21	   logout_uri(Generator, URI),
   22	   (   call(Generator, logout_text(Text)) ; Text = ' (logout)')
   23        },
   24	html(a(href(URI), Name+Text)).
   25login_link(Generator) -->
   26	logged_in_as(Generator, _Name, _Role),
   27	{
   28	    logout_uri(Generator, URI),
   29	   (   call(Generator, logout_text(Text)) ; Text = 'logout')
   30        },
   31	html(a(href(URI), Text)).
   32login_link(Generator) -->
   33	\+ logged_in_as(Generator, _Name, _Role),
   34	{
   35	   login_uri(Generator, URI),
   36	   (   call(Generator, logout_text(Text)) ; Text = 'Log in')
   37        },
   38	html(a(href(URI), Text))