sub login_form {
my ($self, %params) = @_;
$::request->layout->focus('#admin_password');
- $self->render('admin/adminlogin', title => t8('kivitendo v#1 administration', $::form->{version}), %params);
+ $self->render('admin/adminlogin', title => t8('kivitendo v#1 administration', $::form->read_version), %params);
}
sub edit_user_form {
undef $standard_dbh;
}
+sub read_version {
+ my ($self) = @_;
+
+ open VERSION_FILE, "VERSION"; # New but flexible code reads version from VERSION-file
+ my $version = <VERSION_FILE>;
+ $version =~ s/[^0-9A-Za-z\.\_\-]//g; # only allow numbers, letters, points, underscores and dashes. Prevents injecting of malicious code.
+ close VERSION_FILE;
+
+ return $version;
+}
+
sub new {
$main::lxdebug->enter_sub();
bless $self, $type;
- open VERSION_FILE, "VERSION"; # New but flexible code reads version from VERSION-file
- $self->{version} = <VERSION_FILE>;
- close VERSION_FILE;
- $self->{version} =~ s/[^0-9A-Za-z\.\_\-]//g; # only allow numbers, letters, points, underscores and dashes. Prevents injecting of malicious code.
+ $self->{version} = $self->read_version;
$main::lxdebug->leave_sub();