ns_register_proc GET $todomgr_root/login todomgr_login proc todomgr_login {conn ignore} { set userid [ns_conn authuser $conn] if ![string compare $userid ""] { return [todomgr_pageout $conn nologin.html] } |
global todomgr_pool set db [ns_db gethandle $todomgr_pool] set row [ns_db select $db "select * from users where userid='[sql_safe_string $userid]'"] ns_db getrow $db $row foreach field {userid password name email website} { set tags($field) [ns_set get $row $field] } |
set form [ns_conn form $conn] if {$form == ""} { See Showing the current login } else { See Switching logins } } |
set tags(title) "Current login user: $tags(userid) ($tags(name))" return [todomgr_pageout $conn login.html] |
user
parameter and return a 401
if the authuser doesn't match. This forces login with the given userid.
if [string compare [string tolower $userid] [string tolower [ns_set get $form user]]] { ns_set put [ns_conn outputheaders $conn] WWW-Authenticate "BASIC realm=\"task list manager\"" return [todomgr_pageout $conn auth.html 401] } |
See Showing the current login |
This code and documentation are released under the terms of the GNU license. They are additionally copyright (c) 2000, Vivtek. All rights reserved except those explicitly granted under the terms of the GNU license. |