# HG changeset patch # User Adam Chlipala # Date 1295544224 18000 # Node ID c560ec5bf5143477ad263f525b53234e89afed0d # Parent b416b9b9dc3808e225bb482afff8110df48990e9 More flexibility in placement of login form and other similar stuff diff -r b416b9b9dc38 -r c560ec5bf514 src/ur/openidUser.ur --- a/src/ur/openidUser.ur Mon Jan 17 16:07:24 2011 -0500 +++ b/src/ur/openidUser.ur Thu Jan 20 12:23:44 2011 -0500 @@ -261,11 +261,10 @@ cur <- current; here <- currentUrl; case cur of - Some cur => return Logged in as {[cur]}. [Log out] - | None => return -
- Sign up -
+ Some cur => return {Status = Logged in as {[cur]}., + Other = Log out} + | None => return {Status =
, + Other = Sign up} end task periodic 60 = fn () => dml (DELETE FROM session diff -r b416b9b9dc38 -r c560ec5bf514 src/ur/openidUser.urs --- a/src/ur/openidUser.urs Mon Jan 17 16:07:24 2011 -0500 +++ b/src/ur/openidUser.urs Thu Jan 20 12:23:44 2011 -0500 @@ -78,9 +78,12 @@ val current : transaction (option user) (* Figure out which, if any, user is logged in on this connection. *) - val main : (string -> xbody -> transaction page) -> transaction xbody + val main : (string -> xbody -> transaction page) -> transaction {Status : xbody, + Other : xbody} (* Pass in your generic page template; get out the HTML snippet for user * management, suitable for, e.g., inclusion in your standard page - * header. *) + * header. The output gives a "status" chunk, which will either be a login + * form or a message about which user is logged in; and an "other" chunk, + * which will be a log out or sign up link. *) end diff -r b416b9b9dc38 -r c560ec5bf514 tests/utest.ur --- a/tests/utest.ur Mon Jan 17 16:07:24 2011 -0500 +++ b/tests/utest.ur Thu Jan 20 12:23:44 2011 -0500 @@ -36,7 +36,8 @@ return {[title]} - {userStuff} + {userStuff.Status}
+ {userStuff.Other}

{[title]}