143948Sbrian#! /usr/local/bin/wish8.0 -f 243948Sbrian# 343948Sbrian# Copyright (c) 1999 Brian Somers <brian@Awfulhak.org> 443948Sbrian# All rights reserved. 543948Sbrian# 643948Sbrian# Redistribution and use in source and binary forms, with or without 743948Sbrian# modification, are permitted provided that the following conditions 843948Sbrian# are met: 943948Sbrian# 1. Redistributions of source code must retain the above copyright 1043948Sbrian# notice, this list of conditions and the following disclaimer. 1143948Sbrian# 2. Redistributions in binary form must reproduce the above copyright 1243948Sbrian# notice, this list of conditions and the following disclaimer in the 1343948Sbrian# documentation and/or other materials provided with the distribution. 1443948Sbrian# 1543948Sbrian# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1643948Sbrian# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1743948Sbrian# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1843948Sbrian# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1943948Sbrian# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2043948Sbrian# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2143948Sbrian# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2243948Sbrian# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2343948Sbrian# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2443948Sbrian# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2543948Sbrian# SUCH DAMAGE. 2643948Sbrian# 2750476Speter# $FreeBSD: releng/10.2/share/examples/ppp/login-auth 50476 1999-08-28 00:22:10Z peter $ 2843948Sbrian 2943948Sbrian# 3043948Sbrian# Display a window to request a users password, expecting a login name 3143948Sbrian# as an argument and outputting the password to stdout. 3243948Sbrian# 3343948Sbrian 3443948Sbrianset pwidth 11; # Prompt field width 3543948Sbrianset vwidth 20; # Value field width 3643948Sbrianset fxpad 7; # Value field width 3743948Sbrianset fypad 3; # Value field width 3843948Sbrian 3943948Sbrianwm title . "PPP Login"; 4043948Sbrian 4143948Sbrian# Dump our password to stdout and exit 4243948Sbrianproc done {} { 4343948Sbrian puts [.p.value get]; 4443948Sbrian exit 0; 4543948Sbrian} 4643948Sbrian 4743948Sbrianframe .l; 4843948Sbriantext .l.prompt -width $pwidth -height 1 -relief flat; 4943948Sbrian .l.prompt insert 1.0 "Login:"; 5043948Sbrianpack .l.prompt -side left; 5143948Sbrian .l.prompt configure -state disabled; 5243948Sbriantext .l.value -width $vwidth -height 1; 5343948Sbrian .l.value insert 1.0 $argv; 5443948Sbrianpack .l.value -side right; 5543948Sbrian .l.value configure -state disabled; 5643948Sbrianpack .l -side top -padx $fxpad -pady $fypad; 5743948Sbrian 5843948Sbrianframe .p; 5943948Sbriantext .p.prompt -width $pwidth -height 1 -relief flat; 6043948Sbrian .p.prompt insert 1.0 "Password:"; 6143948Sbrianpack .p.prompt -side left; 6243948Sbrian .p.prompt configure -state disabled; 6343948Sbrianentry .p.value -show "*" -width $vwidth; 6443948Sbrianpack .p.value -side right; 6543948Sbrianbind .p.value <Return> {done}; 6643948Sbrianfocus .p.value; 6743948Sbrianpack .p -side top -padx $fxpad -pady $fypad; 6843948Sbrian 6943948Sbrianframe .b; 7043948Sbrianbutton .b.ok -default active -text "Ok" -takefocus 0 -command {done}; 7143948Sbrianpack .b.ok -side left; 7243948Sbrianbutton .b.cancel -default normal -text "Cancel" -takefocus 0 -command {exit 1}; 7343948Sbrianpack .b.cancel -side right; 7443948Sbrianpack .b -side top -padx $fxpad -pady $fypad; 75