Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Forked Xestia Scanner Server!
[xestiascansrv/.git] / cgi-files / Modules / System / Auth.pm
1 #################################################################################
2 # Xestia Scanner Server - Auth System Module                                    #
3 # Version 0.1.0                                                                 #
4 #                                                                               #
5 # Copyright (C) 2010-2011 Steve Brokenshire <sbrokenshire@xestia.co.uk>         #
6 #                                                                               #
7 # This module is licensed under the same license as Xestia Scanner Server which #
8 # is licensed under the GPL version 3.                                          #
9 #                                                                               #
10 # This program is free software: you can redistribute it and/or modify          #
11 # it under the terms of the GNU General Public License as published by          #
12 # the Free Software Foundation, version 3 of the License.                       #
13 #                                                                               #
14 # This program is distributed in the hope that it will be useful,               #
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of                #
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                 #
17 # GNU General Public License for more details.                                  #
18 #                                                                               #
19 # You should have received a copy of the GNU General Public License             #
20 # along with this program.  If not, see <http://www.gnu.org/licenses/>.         #
21 #################################################################################
23 package Modules::System::Auth;
25 use Modules::System::Common;
26 use strict;
27 use warnings;
28 use Exporter;
30 our @ISA = qw(Exporter);
31 our @EXPORT = qw(xestiascan_auth_authenticate xestiascan_auth_logout);
33 sub xestiascan_auth_authenticate{
34 #################################################################################
35 # xestiascan_auth_authenticate: Provides a form for authentication.             #
36 #                                                                               #
37 # Usage:                                                                        #
38 #                                                                               #
39 # xestiascan_auth_authenticate(authfailure);                                    #
40 #                                                                               #
41 # authfailure   Display authentication failure message.                         #
42 #################################################################################
43         
44         my $authfailure = shift;
45         
46         $authfailure = 0 if !$authfailure;
47         
48         if ($authfailure eq 1){
49         
50                 $main::xestiascan_presmodule->startbox("errorsectionbox");
51                 $main::xestiascan_presmodule->startbox("errorboxheader");
52                 $main::xestiascan_presmodule->addtext($main::xestiascan_lang{error}{error});
53                 $main::xestiascan_presmodule->endbox();
54                 $main::xestiascan_presmodule->startbox("errorbox");
55                 $main::xestiascan_presmodule->addtext($main::xestiascan_lang{auth}{loginerror});
56                 $main::xestiascan_presmodule->endbox();
57                 $main::xestiascan_presmodule->endbox();         
58                 
59         }
60         
61         $main::xestiascan_presmodule->startbox("sectionbox");
62         $main::xestiascan_presmodule->startbox("sectiontitle");
63         $main::xestiascan_presmodule->addtext($main::xestiascan_lang{auth}{login});
64         $main::xestiascan_presmodule->endbox();
65         $main::xestiascan_presmodule->startbox("secondbox");
66         
67         $main::xestiascan_presmodule->startform($main::xestiascan_env{"script_filename"}, "POST");
68         $main::xestiascan_presmodule->addhiddendata("mode", "auth");
69         $main::xestiascan_presmodule->starttable("", { CellPadding => "5", CellSpacing => "0" });
70         $main::xestiascan_presmodule->startrow();
71         $main::xestiascan_presmodule->addcell("tablecell1");
72         $main::xestiascan_presmodule->addtext($main::xestiascan_lang{auth}{username});
73         $main::xestiascan_presmodule->endcell();
74         $main::xestiascan_presmodule->addcell("tablecell2");
75         $main::xestiascan_presmodule->addinputbox("username", { Size => 32, MaxLength => 32 });
76         $main::xestiascan_presmodule->endcell();
77         $main::xestiascan_presmodule->endrow();
78         $main::xestiascan_presmodule->startrow();
79         $main::xestiascan_presmodule->addcell("tablecell1");
80         $main::xestiascan_presmodule->addtext($main::xestiascan_lang{auth}{password});
81         $main::xestiascan_presmodule->endcell();
82         $main::xestiascan_presmodule->addcell("tablecell2");
83         $main::xestiascan_presmodule->addinputbox("password", { Size => 64, MaxLength => 128, Password => 1 });
84         $main::xestiascan_presmodule->endcell();
85         $main::xestiascan_presmodule->endrow();
86         $main::xestiascan_presmodule->startrow();
87         $main::xestiascan_presmodule->addcell("tablecell1");
88         $main::xestiascan_presmodule->addtext($main::xestiascan_lang{common}{options});
89         $main::xestiascan_presmodule->endcell();
90         $main::xestiascan_presmodule->addcell("tablecell2");
91         $main::xestiascan_presmodule->addcheckbox("stayloggedin", { OptionDescription => $main::xestiascan_lang{auth}{keeploggedin} });
92         $main::xestiascan_presmodule->endcell();
93         $main::xestiascan_presmodule->endrow(); 
94         $main::xestiascan_presmodule->endtable();
95         $main::xestiascan_presmodule->addlinebreak();
96         $main::xestiascan_presmodule->addsubmit($main::xestiascan_lang{auth}{loginbutton});
97         $main::xestiascan_presmodule->addtext(" | ");
98         $main::xestiascan_presmodule->addreset($main::xestiascan_lang{common}{clearvalues});
99         $main::xestiascan_presmodule->endform();
100         
101         $main::xestiascan_presmodule->endbox();
102         $main::xestiascan_presmodule->endbox();
103         
104         return $main::xestiascan_presmodule->grab();
105         
108 sub xestiascan_auth_logout{
109 #################################################################################
110 # xestiascan_auth_logout: Logout of the Xestia Scanner Server installation.     #
111 #################################################################################
112         
113         $main::xestiascan_presmodule->addtext($main::xestiascan_lang{auth}{loggedout}, { Style => "pageheader" });
114         $main::xestiascan_presmodule->addlinebreak();
115         $main::xestiascan_presmodule->addlinebreak();
116         $main::xestiascan_presmodule->addtext($main::xestiascan_lang{auth}{loggedoutmsg});
117         $main::xestiascan_presmodule->addlinebreak();
118         $main::xestiascan_presmodule->addlinebreak();
119         $main::xestiascan_presmodule->addlink($main::xestiascan_env{"script_filename"}, { Text => $main::xestiascan_lang{auth}{displaylogin} });
120         
121         return $main::xestiascan_presmodule->grab();
122         
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy