require account approval flags
This commit is contained in:
parent
ad61584d7a
commit
b3d5587415
|
@ -120,9 +120,15 @@ func main() {
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: flagNames.AccountsOpenRegistration,
|
Name: flagNames.AccountsOpenRegistration,
|
||||||
Usage: "Allow anyone to submit an account signup request. If false, server will be invite-only.",
|
Usage: "Allow anyone to submit an account signup request. If false, server will be invite-only.",
|
||||||
Value: false,
|
Value: true,
|
||||||
EnvVars: []string{envNames.AccountsOpenRegistration},
|
EnvVars: []string{envNames.AccountsOpenRegistration},
|
||||||
},
|
},
|
||||||
|
&cli.BoolFlag{
|
||||||
|
Name: flagNames.AccountsRequireApproval,
|
||||||
|
Usage: "Do account signups require approval by an admin or moderator before user can log in? If false, new registrations will be automatically approved.",
|
||||||
|
Value: true,
|
||||||
|
EnvVars: []string{envNames.AccountsRequireApproval},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Commands: []*cli.Command{
|
Commands: []*cli.Command{
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,10 +14,9 @@
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
###################
|
###########################
|
||||||
##### CONFIG ######
|
##### GENERAL CONFIG ######
|
||||||
###################
|
###########################
|
||||||
|
|
||||||
# String. Log level to use throughout the application. Must be lower-case.
|
# String. Log level to use throughout the application. Must be lower-case.
|
||||||
# Options: ["debug","info","warn","error","fatal"]
|
# Options: ["debug","info","warn","error","fatal"]
|
||||||
# Default: "info"
|
# Default: "info"
|
||||||
|
@ -39,6 +38,9 @@ host: "localhost"
|
||||||
# Default: "https"
|
# Default: "https"
|
||||||
protocol: "https"
|
protocol: "https"
|
||||||
|
|
||||||
|
############################
|
||||||
|
##### DATABASE CONFIG ######
|
||||||
|
############################
|
||||||
# Config pertaining to the Gotosocial database connection
|
# Config pertaining to the Gotosocial database connection
|
||||||
db:
|
db:
|
||||||
# String. Database type.
|
# String. Database type.
|
||||||
|
@ -72,9 +74,26 @@ db:
|
||||||
# Default: "postgres"
|
# Default: "postgres"
|
||||||
database: "postgres"
|
database: "postgres"
|
||||||
|
|
||||||
|
###############################
|
||||||
|
##### WEB TEMPLATE CONFIG #####
|
||||||
|
###############################
|
||||||
# Config pertaining to templating of web pages/email notifications and the like
|
# Config pertaining to templating of web pages/email notifications and the like
|
||||||
template:
|
template:
|
||||||
# String. Directory from which gotosocial will attempt to load html templates (.tmpl files).
|
# String. Directory from which gotosocial will attempt to load html templates (.tmpl files).
|
||||||
# Examples: ["/some/absolute/path/", "./relative/path/", "../../some/weird/path/"]
|
# Examples: ["/some/absolute/path/", "./relative/path/", "../../some/weird/path/"]
|
||||||
# Default: "./web/template/"
|
# Default: "./web/template/"
|
||||||
baseDir: "./web/template/"
|
baseDir: "./web/template/"
|
||||||
|
|
||||||
|
###########################
|
||||||
|
##### ACCOUNTS CONFIG #####
|
||||||
|
###########################
|
||||||
|
# Config pertaining to creation and maintenance of accounts on the server, as well as defaults for new accounts.
|
||||||
|
accounts:
|
||||||
|
# Bool. Do we want people to be able to just submit sign up requests, or do we want invite only?
|
||||||
|
# Options: [true, false]
|
||||||
|
# Default: true
|
||||||
|
openRegistration: true
|
||||||
|
# Bool. Do sign up requests require approval from an admin/moderator before an account can sign in/use the server?
|
||||||
|
# Options: [true, false]
|
||||||
|
# Default: true
|
||||||
|
requireApproval: true
|
||||||
|
|
|
@ -18,7 +18,12 @@
|
||||||
|
|
||||||
package config
|
package config
|
||||||
|
|
||||||
|
// AccountsConfig contains configuration to do with creating accounts, new registrations, and defaults.
|
||||||
type AccountsConfig struct {
|
type AccountsConfig struct {
|
||||||
// Do we want people to be able to just submit sign up requests, or do we want invite only?
|
// Do we want people to be able to just submit sign up requests, or do we want invite only?
|
||||||
OpenRegistration bool
|
OpenRegistration bool `yaml:"openRegistration"`
|
||||||
|
// Do sign up requests require approval from an admin/moderator?
|
||||||
|
RequireApproval bool `yaml:"requireApproval"`
|
||||||
|
// Do we require a reason for a sign up or is an empty string OK?
|
||||||
|
ReasonRequired bool `yaml:"reasonRequired"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,6 +142,10 @@ func (c *Config) ParseCLIFlags(f KeyedFlags) {
|
||||||
if f.IsSet(fn.AccountsOpenRegistration) {
|
if f.IsSet(fn.AccountsOpenRegistration) {
|
||||||
c.AccountsConfig.OpenRegistration = f.Bool(fn.AccountsOpenRegistration)
|
c.AccountsConfig.OpenRegistration = f.Bool(fn.AccountsOpenRegistration)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if f.IsSet(fn.AccountsRequireApproval) {
|
||||||
|
c.AccountsConfig.RequireApproval = f.Bool(fn.AccountsRequireApproval)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// KeyedFlags is a wrapper for any type that can store keyed flags and give them back.
|
// KeyedFlags is a wrapper for any type that can store keyed flags and give them back.
|
||||||
|
@ -169,6 +173,7 @@ type Flags struct {
|
||||||
DbDatabase string
|
DbDatabase string
|
||||||
TemplateBaseDir string
|
TemplateBaseDir string
|
||||||
AccountsOpenRegistration string
|
AccountsOpenRegistration string
|
||||||
|
AccountsRequireApproval string
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetFlagNames returns a struct containing the names of the various flags used for
|
// GetFlagNames returns a struct containing the names of the various flags used for
|
||||||
|
@ -188,6 +193,7 @@ func GetFlagNames() Flags {
|
||||||
DbDatabase: "db-database",
|
DbDatabase: "db-database",
|
||||||
TemplateBaseDir: "template-basedir",
|
TemplateBaseDir: "template-basedir",
|
||||||
AccountsOpenRegistration: "accounts-open-registration",
|
AccountsOpenRegistration: "accounts-open-registration",
|
||||||
|
AccountsRequireApproval: "accounts-require-approval",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,5 +214,6 @@ func GetEnvNames() Flags {
|
||||||
DbDatabase: "GTS_DB_DATABASE",
|
DbDatabase: "GTS_DB_DATABASE",
|
||||||
TemplateBaseDir: "GTS_TEMPLATE_BASEDIR",
|
TemplateBaseDir: "GTS_TEMPLATE_BASEDIR",
|
||||||
AccountsOpenRegistration: "GTS_ACCOUNTS_OPEN_REGISTRATION",
|
AccountsOpenRegistration: "GTS_ACCOUNTS_OPEN_REGISTRATION",
|
||||||
|
AccountsRequireApproval: "GTS_ACCOUNTS_REQUIRE_APPROVAL",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user