Domino Login Bookmarklet
How to login to a Domino database on the web. This is what more than one person has asked with respect to the DomBlog template. Why haven't I got a "login" link on it? Well, basically, because I don't think a website should. Admin of any website should be kept separate. Why would a reader want to see a login link? All it does is make one person's life a little simpler.
So, how do I login? The same way I login to all other web DBs, including this one. With a Bookmarklet. In essence a little snippet of JavaScript like below:
javascript:location.search+='&login';
In most cases this will suffice. Not so when you don't have a query portion to the URL. So the code would work for this URL:
http://www.codestore.net/A55692/store.nsf?OpenDatabase
But not this one:
http://www.codestore.net/A55692/store.nsf/
The perfect solution is a script that first checks for the presence of the search portion and that it includes an "open" command. Like so:
javascript:location.search += (location.search=='' || location.search.toLowerCase().indexOf('open') == -1) ? '?Open&Login' : '&login';
To add it to your links, bookmark this --> "Domino Login". It should work on any Domino site/element as long as the .nsf part is present in the URL...
Note: You might think the link above is broken as it does nothing when you click it. It's not. To bookmark it either right-click or drag to the bookmarks folder.
This is an awesome bookmarklet Jake, thanks!
Two great tips in as many days... one would think that you're trying to pull ahead of the pack!
...or at least keep your mind off of the recent unpleasentness. ;-)
Thanks again!
-Chris
http://www.dominoguru.com
What about login out again?
Close your browser windows
If you are using session based logins simply closing the browser leaves a session open on the server, you can use this bookmarklet to logout, it is not great however it relies on .nsf being present.
javascript:location.href = location.href.substring(0,location.href.indexOf(".nsf")+4) + "/?logout";
Here is a notes way to logout, if your just looking to switch users in the same database.
Db := @ReplaceSubstring(@Text(@Subset(@DbName;-1));"\\";"/");
@URLOpen(Db+"?Logout&redirectTo=/"+Db)
Granted I haven't thought long on this, but I'm reading your "Domino Login" and I don't get why you use the ".search". Either time, in fact.
I get the += (assignment with operation), and the ? : (conditional operator). Use them all the time. I also use the search method on strings, but only to match regular expressions where it returns "the position of the start of the first substring of string that matches regexp or -1 if no match was found" -- to quote my O'Reilly JS book.
So, would you mind "reading" it to me?
This is all very well for us techies, but for the common luser they need to have a specific link to force the login otherwise they get confused.
Personally if a lot of different users are going to be using the system, then I'm all for having an actual login link. If it's just for me to use then I don't bother.
I have many DBs that have default reader access to all parts of the system. When the user is required to perform a specific action - they can login to authenticate.
Trouble is, even if you login at the .nsf level of the url, IE often 'loses' your credentials.
The only sure way around this I've found is to set a cookie when you login, and then each page checks for the presence of the cookie and appends '&login' to every link it produces in order to force IE to re-send the credentials.
Very messy !
Anyone else had these problems ?
Top site-admin tip Jake.
But there are cases where a login link would be useful - where USERS have to authenticate for personalised pages or interactive elements. Like Notes.net really.
I'm not sure I will bother though. I will just put "(Requires Login)" or something on the end of the title attribute of <a> elements that link to bits that require authentication, such as something?OpenForm, or whatever. Then anonymous has reader access and default applies to anyone logged in, and can have author access for interactive areas such as comments or discussion forums. Now that can't be proper English. What's the plural of forum? Can't be Fora, surely? Sounds like Flora and Fauna. Sorry, off-topic there.
Anyway, anyone who clicks one of my "(Requires Login)" links and fails to authenticate will be told by the $$ReturnAuthorizationFailure or $$ReturnAuthenticationFailure form how to "get" a login. Then I will get more subscribers hopefully. My reason for requiring authentication for interactive areas is that I want to run polls/votes/etc that won't show anyone results so far until after they have voted, and won't let them vote twice (unless they are bloody-minded enough to create dual logins in which case they need to get out more).
I don't know if it's possible to create a Login link without using JavaScript. On a document, you can get an equivalent URL to the current URL up to the end of the DocumentUniqueId and maybe add ?Open&Login by using the following formula: "http://" + Server_Name + "/" + @ReplaceSubString( @Subset( @DbName; -1 ); "\\"; "/" ) + "/" + "ViewNameOrNumberZero" + "/" + @Text(@DocumentUniqueId) + "?Open&Login"
I think. On design elements such as views or pages it would be as simple as doing the following: "http://" + Server_Name + "/" + @ReplaceSubString( @Subset( @DbName; -1 ); "\\"; "/" ) + "ViewOrPageName" + "?Open&Login"
I can't be the only person interested in accessibility for non-scriptable browsers. Can I?
The following can be used to create a login/logout link:
REM "Script to create login/logout link";
MyDB :=@ReplaceSubstring(@Subset(@DbName;-1);"";"/");
@SetTargetFrame("_top");
"[<a href=""+@If(@Name([CN];@UserName) = "Anonymous";
"/"+MyDB+"?OpenDatabase&Login" target=_top>Login</a>]";
"/"+MyDB+"?Logout&Redirectto="+MyDB+"" target=_top>Logout</a>]")
The amount of times I use "@ReplaceSubstring( @Subset( @DbName; -1 ); ""; "/")", you'd think they give us a ready made @ function for that, wouldn't you? Maybe there is one in R6!
Tone -yes, R6 has @WebDBName - pretty handy
Marc