operate('clear passwords', 'clear', services)
@CGI.subcommand(
+ 'logout', ['cgi'],
+ 'Log out of the web interface.')
+def cmd_logout_cgi():
+ CGI.redirect(CGI.action('login', why = 'LOGOUT'),
+ set_cookie = HA.bake_cookie('logged-out'))
+
+@CGI.subcommand(
'fail', ['cgi-noauth'],
'Raise an exception, to test the error reporting machinery.',
opts = [SC.Opt('partial', '-p', '--partial',
'EXPIRED': 'session timed out',
'BADTAG': 'incorrect tag',
'NOUSER': 'unknown user name',
+ 'LOGOUT': 'explicitly logged out',
None: None
}
global NONCE
+ ## If the token has been explicitly clobbered, then we're logged out.
+ if token == 'logged-out': raise AuthenticationFailed, 'LOGOUT'
+
## Parse the token.
bits = token.split('.', 3)
if len(bits) != 4: raise AuthenticationFailed, 'BADTOKEN'
<input type=hidden name=%nonce value="~={nonce}H">
</form>
+<h2>Log out of Chopwood</h2>
+
+<form method=GET action="~={script}H/logout">
+<button type=submit>Log out</button>
+<input type=hidden name=%user value="~={user}H">
+<input type=hidden name=%nonce value="~={nonce}H">
+</form>
+
~1[<!------- That's all, folks ------------------------------------------>~]~