Added an option to disable/enable registration.
Some checks failed
Test CloudVista on Ubuntu Latest / test (push) Has been cancelled
Some checks failed
Test CloudVista on Ubuntu Latest / test (push) Has been cancelled
This commit is contained in:
@@ -21,6 +21,7 @@ my $STORAGE_ROOT = "/var/www/storage"; # must be writable by httpd user
|
|||||||
my $MAX_UPLOAD = 1073741824; # 1 GB
|
my $MAX_UPLOAD = 1073741824; # 1 GB
|
||||||
my $SCRIPT_NAME = $ENV{SCRIPT_NAME} || "/cgi-bin/cloudvista.cgi";
|
my $SCRIPT_NAME = $ENV{SCRIPT_NAME} || "/cgi-bin/cloudvista.cgi";
|
||||||
my $COOKIE_DAYS = 30;
|
my $COOKIE_DAYS = 30;
|
||||||
|
MY $REGISTER_EN = "true";
|
||||||
```
|
```
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
@@ -45,7 +46,7 @@ my $COOKIE_DAYS = 30;
|
|||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Users can:
|
Users can:
|
||||||
- Register a new account with username and password
|
- Register a new account with username and password if registration is enabled
|
||||||
- Login to access their file storage
|
- Login to access their file storage
|
||||||
- Upload files (up to 1GB each)
|
- Upload files (up to 1GB each)
|
||||||
- Download their files
|
- Download their files
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ my $STORAGE_ROOT = "/var/www/storage"; # must be writable by httpd user
|
|||||||
my $MAX_UPLOAD = 1073741824; # 1 GB
|
my $MAX_UPLOAD = 1073741824; # 1 GB
|
||||||
my $SCRIPT_NAME = $ENV{SCRIPT_NAME} || "/cgi-bin/cloudvista.cgi";
|
my $SCRIPT_NAME = $ENV{SCRIPT_NAME} || "/cgi-bin/cloudvista.cgi";
|
||||||
my $COOKIE_DAYS = 30;
|
my $COOKIE_DAYS = 30;
|
||||||
|
my $REGISTER_EN = "true";
|
||||||
##############################################################
|
##############################################################
|
||||||
|
|
||||||
$CGI::POST_MAX = $MAX_UPLOAD;
|
$CGI::POST_MAX = $MAX_UPLOAD;
|
||||||
@@ -293,7 +294,7 @@ if ($action eq 'register') {
|
|||||||
}
|
}
|
||||||
elsif ($pass ne $confirm) { $err = 'passwords do not match.';
|
elsif ($pass ne $confirm) { $err = 'passwords do not match.';
|
||||||
}
|
}
|
||||||
else {
|
elsif ($REGISTER_EN eq "true") {
|
||||||
my $uh = md5_hex($user);
|
my $uh = md5_hex($user);
|
||||||
my $ph = md5_hex($pass);
|
my $ph = md5_hex($pass);
|
||||||
my $udir = "$STORAGE_ROOT/$uh";
|
my $udir = "$STORAGE_ROOT/$uh";
|
||||||
@@ -307,6 +308,8 @@ if ($action eq 'register') {
|
|||||||
else {
|
else {
|
||||||
send_redirect($SCRIPT_NAME, make_login_cookies($uh, $ph));
|
send_redirect($SCRIPT_NAME, make_login_cookies($uh, $ph));
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$err = 'Registration is disabled.';
|
||||||
}
|
}
|
||||||
|
|
||||||
send_page_header();
|
send_page_header();
|
||||||
|
|||||||
Reference in New Issue
Block a user