summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-06-22 00:24:12 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-06-22 00:24:12 +0000
commit426e5a7263770cee8138d44a8c66a257ed7665de (patch)
treef2d868b0b077da13436b2a047da15e426e7452ed /bin
parent70214dbe42db1d4baba8423d7adad1d9490cdd8d (diff)
session expired/password request screen now uses UI templates
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1299 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'bin')
-rw-r--r--bin/pw.pl69
1 files changed, 20 insertions, 49 deletions
diff --git a/bin/pw.pl b/bin/pw.pl
index f03ed240..99020906 100644
--- a/bin/pw.pl
+++ b/bin/pw.pl
@@ -34,59 +34,30 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#======================================================================
+use LedgerSMB::Template;
+
1;
# end of main
sub getpassword {
- my ($s) = @_;
-
- $form->{endsession} = 1;
-
- $sessionexpired =
- qq|<p><span style="font-weight:bold; color:red;">|
- . $locale->text('Session expired!')
- . qq|</span></p>|
- if $s;
-
- my $headeradd = qq|
-<script language="JavaScript" type="text/javascript">
-<!--
-function sf(){
- document.pw.password.focus();
-}
-// End -->
-</script>|;
-
- $form->header( undef, $headeradd );
- print qq|
-<body onload="sf()">
-
- $sessionexpired
-
-<form method=post action=$form->{script} name=pw>
-
-<table>
- <tr>
- <th align=right>| . $locale->text('Password') . qq|</th>
- <td><input type="password" name="password" size="30"></td>
- <td><button type="submit" value="continue">|
- . $locale->text('Continue')
- . qq|</button></td>
- </tr>
-</table>
-
-|;
-
- for (qw(script endsession password)) { delete $form->{$_} }
- $form->hide_form;
-
- print qq|
-</form>
-
-</body>
-</html>
-|;
-
+ $form->{sessionexpired} = shift @_;
+ @{$form->{hidden}};
+ for (keys %$form){
+ next if $_ =~ /(^script$|^endsession$|^password$)/;
+ my $attr = {};
+ $attr->{name} = $_;
+ $attr->{value} = $form->{$_};
+ push @{$form->{hidden}}, $attr;
+ }
+ my $template = Template->new(
+ user => \%myconfig,
+ locale => $locale,
+ path => 'UI',
+ template => 'get_password.html',
+ format => 'HTML'
+ );
+ $template->render($form);
+ exit;
}