feat: fileshare custom password support (#2493)
* feat: fileshare custom password support * fix: blank password check * feat: backend share link password check * Revert "feat: backend share link password check" This reverts commit 22c7bb0b355235b48b29938eb995b3986b1122f1. * feat: use go-playground/validator binding rule
This commit is contained in:
@@ -111,6 +111,7 @@ type (
|
||||
CreateShareArgs struct {
|
||||
ExistedShareID int
|
||||
IsPrivate bool
|
||||
Password string
|
||||
RemainDownloads int
|
||||
Expire *time.Time
|
||||
ShareView bool
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"encoding/gob"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/cloudreve/Cloudreve/v4/application/constants"
|
||||
@@ -259,7 +260,10 @@ func (l *manager) CreateOrUpdateShare(ctx context.Context, path *fs.URI, args *C
|
||||
|
||||
password := ""
|
||||
if args.IsPrivate {
|
||||
password = util.RandString(8, util.RandomLowerCases)
|
||||
password = args.Password
|
||||
if strings.TrimSpace(password) == "" {
|
||||
password = util.RandString(8, util.RandomLowerCases)
|
||||
}
|
||||
}
|
||||
|
||||
props := &types.ShareProps{
|
||||
|
||||
Reference in New Issue
Block a user