[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb: [1327] trunk/scripts/login.pl
- Subject: SF.net SVN: ledger-smb: [1327] trunk/scripts/login.pl
- From: ..hidden..
- Date: Mon, 25 Jun 2007 22:32:08 -0700
Revision: 1327
http://svn.sourceforge.net/ledger-smb/?rev=1327&view=rev
Author: einhverfr
Date: 2007-06-25 22:32:07 -0700 (Mon, 25 Jun 2007)
Log Message:
-----------
Adding login script
Added Paths:
-----------
trunk/scripts/login.pl
Added: trunk/scripts/login.pl
===================================================================
--- trunk/scripts/login.pl (rev 0)
+++ trunk/scripts/login.pl 2007-06-26 05:32:07 UTC (rev 1327)
@@ -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;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.