From a0862f0fdb997f07f60e257224b970bb76837e2c Mon Sep 17 00:00:00 2001
From: Petr Baudis
Date: Thu, 11 Sep 2008 18:38:12 +0200
Subject: [PATCH] Girocco::Config::project_passwords: Introduce; allow password
protection turned off
---
Girocco/Config.pm | 6 ++++++
Girocco/Project.pm | 7 ++++---
cgi/delproj.cgi | 6 ++++++
cgi/editproj.cgi | 6 ++++++
cgi/regproj.cgi | 10 +++++++++-
5 files changed, 31 insertions(+), 4 deletions(-)
diff --git a/Girocco/Config.pm b/Girocco/Config.pm
index 3a65b74..3fa2fc6 100644
--- a/Girocco/Config.pm
+++ b/Girocco/Config.pm
@@ -33,6 +33,12 @@ our $manage_users = 1;
# Enable the special 'mob' user if set to 'mob'
our $mob = "mob";
+# Let users set admin passwords; if false, all password inputs are assumed empty.
+# This will make new projects use empty passwords and all operations on them
+# unrestricted, but you will be able to do no operations on previously created
+# projects you have set a password on.
+our $project_passwords = 1;
+
## Paths
diff --git a/Girocco/Project.pm b/Girocco/Project.pm
index 8e7ad23..194e667 100644
--- a/Girocco/Project.pm
+++ b/Girocco/Project.pm
@@ -274,12 +274,13 @@ sub cgi_fill {
my ($gcgi) = @_;
my $cgi = $gcgi->cgi;
- my $pwd = $cgi->param('pwd');
- if ($pwd ne '' or not $self->{crypt}) {
+ my ($pwd, $pwd2) = ($cgi->param('pwd'), $cgi->param('pwd2'));
+ $pwd ||= ''; $pwd2 ||= ''; # in case passwords are disabled
+ if ($pwd or not $self->{crypt}) {
$self->{crypt} = scrypt($pwd);
}
- if ($cgi->param('pwd2') and $pwd ne $cgi->param('pwd2')) {
+ if ($pwd2 and $pwd ne $pwd2) {
$gcgi->err("Our high-paid security consultants have determined that the admin passwords you have entered do not match each other.");
}
diff --git a/cgi/delproj.cgi b/cgi/delproj.cgi
index 1f0f0e2..4b679f3 100755
--- a/cgi/delproj.cgi
+++ b/cgi/delproj.cgi
@@ -67,7 +67,13 @@ print <