📄 getpin.tcl
字号:
} else { set question "pin" } } default { puts "Error: Invalid email address format.\n" set question "email" } } } "pin" { if { $lmVals(lmPinRequired) } { # if a pin number has been saved in the registry, use it if { "$reg(pin)" == "" } { set ret [prompt "PIN: "] } else { set ret [prompt "PIN: \[$reg(pin)\]"] } switch -regexp -- $ret { "^[eE][xX][iI][tT]$" { return 0 } "^-$" { set question "email" } "^$" { if { $reg(pin) != "" } { set lmVals(pinNum) $reg(pin) # send the PIN to the database app. # send the AuthorizePinRequest = 4 request set params "$setupVals(WRSLicense)|$lmVals(pinNum)|$lmVals(token)" set reply [sendToALD $AuthorizePinRequest $params] set reply [string trim $reply] if {[string compare "OK" $reply] == 0} { set question "savePin" } else { puts [strTableGet USERAUTH_FAILED] set question "pin" } } else { puts "Error: you must enter an Authorization Code.\n" set question "pin" } } "^[0-9]+" { set lmVals(pinNum) $ret # send the PIN to the database app. # send the AuthorizePinRequest = 4 request set params \ "$setupVals(WRSLicense)|$lmVals(pinNum)|$lmVals(token)" set reply [sendToALD $AuthorizePinRequest $params] set reply [string trim $reply] if {[string compare "OK" $reply] == 0} { set question "savePin" } else { puts [strTableGet USERAUTH_FAILED] set question "pin" } } default { puts "Error: Invalid PIN.\n" set question "pin" } } } } "savePin" { set msg "Would you like save the Authorization Code\ for automatic retrieval? \[Y\]" set ret [prompt $msg] switch -regexp -- $ret { "^[eE][xX][iI][tT]$" { return 0 } "^-$" { set question "pin" } "^$" - "^[Yy](es)?" { set lmSavePin 1 set question "done" } "^[Nn](o)?" { set lmSavePin 0 set question "done" } default { puts "Error: Invalid input.\n" set question "savePin" } } } } } nextCallback return 0 }}############################################################################### onSavePin - callback for savePin boolean## This procedure sets a value to indicate that the user wants to save the# authorization code in the registry.## SYNOPSIS# .tS# onSavePin()# .tE## PARAMETERS: N/A## RETURNS: N/A## ERRORS: N/A#proc onSavePin {} { global lmSavePin if {[controlChecked wizardDialog.savePin] == 1} { set lmSavePin 1 } else { set lmSavePin 0 }}############################################################################### onPin - callback for pinNum text box## This procedure validates that the entry is all numeric and stores the# value in lmVals(lmPinNum)## SYNOPSIS# .tS# onPin()# .tE## PARAMETERS: N/A## RETURNS: N/A## ERRORS: N/A#proc onPin {} { global lmVals isNumeric [controlValuesGet wizardDialog.pin] \ "User Authorization" wizardDialog.pin set lmVals(pinNum) [controlValuesGet wizardDialog.pin] if {$lmVals(pinNum) != ""} { controlEnable wizardDialog.nextButt 1 } else { controlEnable wizardDialog.nextButt 0 }}############################################################################### pageProcess(userAuthorization) - process inputs from userAuthorization page## This procedure will process inputs from the userAuthorization page## SYNOPSIS# .tS# pageProcess(userAuthorization)# .tE## PARAMETERS: N/A## RETURNS: 1 when successful, else 0## ERRORS: N/A#proc pageProcess(userAuthorization) {} { global setupVals ctrlVals lmVals global AuthorizePinRequest lmSavePin if { [isGUImode] } { # error checking foreach var {sysAdminName userPhone userEmail} { if { "$setupVals($var)" == "" } { messageBox [strTableGet USERAUTH_DLG_ERR1] return 0 } } if { ![regexp {^[a-zA-Z0-9].*@.*} $setupVals(userEmail)] } { messageBox "Invalid email address format: $setupVals(userEmail)" return 0 } if {$lmVals(pinNum) != 0} { beginWaitCursor # send the PIN to the database app. # send the AuthorizePinRequest = 4 request set params "$setupVals(WRSLicense)|$lmVals(pinNum)|$lmVals(token)" set reply [sendToALD $AuthorizePinRequest $params] set reply [string trim $reply] endWaitCursor if {[string compare "OK" $reply] != 0} { pinAuthorizationFailedDlg return 0 } } } if { ![isStandAlone] } { # write the pin into registry if { $lmSavePin } { regValueWriteLog HKEY_CURRENT_USER \ "Software\\$setupVals(WRS)" "pin" $lmVals(pinNum) } else { if {[regValueExists HKEY_CURRENT_USER \ "Software\\$setupVals(WRS)" "pin"]} { if {[catch {sysRegistryValueDelete HKEY_CURRENT_USER \ "Software\\$setupVals(WRS)" "pin"} err]} { puts "cannot delete registry key, \"pin\": $err" } } } # write other user values into registry foreach var {sysAdminName userPhone userEmail} { regValueWriteLog HKEY_CURRENT_USER \ "Software\\$setupVals(WRS)" "$var" $setupVals($var) } } queueExecute return 1}############################################################################### pinAuthorizationFailedDlg - displays pin authorization failure## This procedure will display the PIN number authorization failed dialog## SYNOPSIS# .tS# pageProcess(userAuthorization)# .tE## PARAMETERS: N/A## RETURNS: 1 when successful, else 0## ERRORS: N/A#proc pinAuthorizationFailedDlg {} { set result [dialog resume_exit "User Authorization Failed" \ [strTableGet USERAUTH_FAILED]] if {$result == 1} { quitCallback }}####################################################################### Dialog Text Messages######################################################################set strTable(USERAUTH_TITLE) "User Authorization"set strTable(USERAUTH_TITLE_NOPIN) "Contact Information"set strTable(USERAUTH_NOPIN_MSG) \ "Please enter your name, phone number and email."set strTable(USERAUTH_USEPIN_MSG) \ "Please enter your name, phone number, email and your\ Authorizaion Code. Your Autorization Code is printed on the\ Installation Keys form in your [cdromDescGet] shipment."set strTable(USERAUTH_FAILED) \ "The Authorization Code you have entered is NOT valid. Please\ check the Authorization Code on your Installation Keys form and\ re-enter it. The Installation Key form is shipped with your\ [cdromDescGet] shipment."set strTable(SAVE_AUTHCODE) \ "Save the Authorization Code for automatic retrieval."set strTable(USERAUTH_DLG_ERR1) \ "Please enter the requested information."
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -