* Make sure that automatic closing of connections only affects
[alpine.git] / web / cgi / session / setpassphrase.tcl
blobb4d25e26e3c200adcd13cd6383e086d9a7b965c3
1 #!./tclsh
2 # $Id: setpassphrase.tcl 1142 2008-08-13 17:22:21Z hubert@u.washington.edu $
3 # ========================================================================
4 # Copyright 2008 University of Washington
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # ========================================================================
14 # setpassphrase.tcl
16 # Purpose: CGI script to accept user passphrase
17 # via xmlHttpRequest
19 # Input:
20 set auth_vars {
21 {auths "" 0}
22 {pass "" 0}
23 {cancel "" 0}
26 # Output:
29 # inherit global config
30 source ./alpine.tcl
32 # Import data validate it and get session id
33 if {[catch {WPGetInputAndID sessid}]} {
34 return
37 # grok parameters
38 foreach item $auth_vars {
39 if {[catch {eval WPImport $item} errstr]} {
40 WPInfoPage "Web Alpine Error" [font size=+2 $errstr] "Please close this window."
41 return
45 cgi_puts "Content-type: text/html; charset=\"UTF-8\"\n"
46 set answer "Problem setting passphrase"
48 if {[string compare $auths "Smime"] != 0
49 || [string length $pass] == 0
50 || [catch {WPCmd PESession setpassphrase $pass} answer]} {
51 cgi_puts "Cannot accept passphrase: $answer"