01.12.2012 Views

7 Components: the Function Pages - Developers

7 Components: the Function Pages - Developers

7 Components: the Function Pages - Developers

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Confirmation of<br />

<strong>the</strong> logout<br />

216<br />

��<br />

��<br />

��<br />

template of <strong>the</strong> confirmation text (see below), yet to be generated.<br />

Finally, we transfer <strong>the</strong> name of <strong>the</strong> user that has logged out.<br />

Tip: You can achieve direct redirecting to a TWiki page with <strong>the</strong><br />

command TWiki::getViewUrl("Web", "Topic") instead<br />

of TWiki::getOopsUrl.<br />

Why is this confirmation so important? We can only delete <strong>the</strong><br />

server from <strong>the</strong> server's records. The HTTP au<strong>the</strong>ntication, however,<br />

works via <strong>the</strong> browser. It remembers <strong>the</strong> login data and sends it upon<br />

request (that is, in <strong>the</strong> presence of a protected script) back to <strong>the</strong><br />

server, which once again enters <strong>the</strong> data in <strong>the</strong> remote user file. After<br />

our logout, it is possible that <strong>the</strong> browser could log <strong>the</strong> user back in<br />

unintentionally. That is why it is necessary, on one hand, to display a<br />

message explaining this situation and, on <strong>the</strong> o<strong>the</strong>r, to redirect <strong>the</strong><br />

user to a non-locked page.<br />

Tip: For <strong>the</strong> Firefox browser, <strong>the</strong>re is <strong>the</strong> Web Developer, a very<br />

good plugin that enables <strong>the</strong> HTTP au<strong>the</strong>ntication to be reset (Miscellaneous<br />

-> Clear HTTP Au<strong>the</strong>ntication).<br />

One possible display via <strong>the</strong> template system is printed below. For<br />

details on <strong>the</strong> templates, see Chapter 16.1.3. Save <strong>the</strong> following file<br />

under <strong>the</strong> name oopslogoff.tmpl in <strong>the</strong> templates directory:<br />

%TMPL:INCLUDE{"TWiki"}%<br />

%TMPL:DEF{"titleaction"}%(oops) %TMPL:END%<br />

%TMPL:DEF{"webaction"}%<br />

*Attention*<br />

%TMPL:END%<br />

%TMPL:DEF{"heading"}%Logout%TMPL:END%<br />

%TMPL:DEF{"message"}%<br />

User %PARAM1% is now logged out.<br />

Be careful! You have to shut down your<br />

browser in order to complete <strong>the</strong> logout. If<br />

you don't, <strong>the</strong> browser will log you on again<br />

once you hit an au<strong>the</strong>nticated page.<br />

%TMPL:END%<br />

%TMPL:DEF{"topicaction"}%<br />

[[%WEB%.%TOPIC%][OK]]<br />

%TMPL:END%<br />

%TMPL:P{"oops"}%<br />

14 User Permissions in TWiki

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!