summaryrefslogtreecommitdiff
path: root/web/src/cgi.tcl-1.10/example/passwd-form.cgi
blob: 9d99b716597715db099ed7f6a16bee87aadf0ebb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/depot/path/tclsh

# This is a CGI script to present a form in which to change a password.

# This form doesn't actually have to be written as a CGI script,
# however, it is done so here to demonstrate the procedures described
# in the Tcl '96 paper by Don Libes.  You can find this same form
# written as static html in the example directory of the Expect
# package.

package require cgi

cgi_eval {
    source example.tcl
    source passwd.tcl

    cgi_input

    # Use a cookie so that if user has already entered name, don't make them
    # do it again.  If you dislike cookies, simply remove the next two
    # lines - cookie use here is simply a convenience for users.
    set login ""
    catch {cgi_import_cookie login}

    cgi_title "Change your login password"
    cgi_body {
	cgi_form passwd {
	    put "Username: "; cgi_text login size=16
	    password "Old" old
	    password "New" new1
	    password "New" new2

	    p "(The new password must be entered twice to avoid typos.)"

	    cgi_submit_button "=Change password"
	    cgi_reset_button
	}
    }
}