diff options
author | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-06-26 05:32:07 +0000 |
---|---|---|
committer | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-06-26 05:32:07 +0000 |
commit | 96931013a1851dc0767162d351d3397b1365187b (patch) | |
tree | fdb635337511a12e9e563b6693fd802ac4e82c06 /scripts | |
parent | 1ce9ea5e5fdd39bad2b68c43e81fc59d1cffb389 (diff) |
Adding login script
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1327 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/login.pl | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/scripts/login.pl b/scripts/login.pl new file mode 100644 index 00000000..b07d9c3d --- /dev/null +++ b/scripts/login.pl @@ -0,0 +1,68 @@ +#!/usr/bin/perl +package LedgerSMB::Scripts::login; +our $VERSION = 0.1; + +use LedgerSMB::Locale; +use LedgerSMB::Form; # Required for now to integrate with menu module. +use LedgerSMB::User; +use strict; + +sub __default { + my ($request) = @_; + my $locale; + $locale = LedgerSMB::Locale->get_handle(${LedgerSMB::Sysconfig::language}) + or $request->error( __FILE__ . ':' . __LINE__ . + ": Locale not loaded: $!\n" ); + my $template = LedgerSMB::Template->new( + user =>$request->{_user}, + locale => $locale, + path => 'UI', + template => 'login', + format => 'HTML' + ); + $template->render($request); +} + + +sub login { + my ($request) = @_; + + if (!$request->{_user}){ + __default($request); + } + our $user = new LedgerSMB::User($request->{login}); + our $form = new Form; + for (keys %$request){ + $form->{$_} = $request->{$_}; + } + my $menu_entrypoint; + require "bin/menu.pl"; + if (($request->{_user}->{acs} !~ /Recurring Transactions/) || + $request->{_user}->{role} ne 'user'){ + if ($user->check_recurring($form) ) { + $form->{main} = "recurring_transactions"; + } + else { + $form->{main} = "company_logo"; + } + + } + else { + + $form->{main} = "company_logo"; + } + &display; + +} + +sub logout { + my ($request) = @_; + $request->{callback} = ""; + $request->{endsession} = 1; + Session::session_destroy($request); + print "Location: login.pl\n"; + print "Content-type: text/html\n\n"; + exit; +} + +1; |