Attempt at removing login screen

pull/3922/head
LostB053 2025-05-21 20:55:34 +02:00
parent cfea84fd5e
commit 6bad006b97
9 changed files with 13 additions and 0 deletions

View File

@ -31,6 +31,7 @@ func addConfigFlags(flags *pflag.FlagSet) {
addServerFlags(flags)
addUserFlags(flags)
flags.BoolP("signup", "s", false, "allow users to signup")
flags.Bool("publiclogin", true, "allow users to login from the public page")
flags.Bool("create-user-dir", false, "generate user's home directory automatically")
flags.String("shell", "", "shell command to which other commands should be appended")

View File

@ -31,6 +31,7 @@ override the options.`,
s := &settings.Settings{
Key: generateKey(),
Signup: mustGetBool(flags, "signup"),
PublicLogin: mustGetBool(flags, "publiclogin"),
CreateUserDir: mustGetBool(flags, "create-user-dir"),
Shell: convertCmdStrToCmdArray(mustGetString(flags, "shell")),
AuthMethod: authMethod,

View File

@ -43,6 +43,8 @@ you want to change. Other options will remain unchanged.`,
ser.Port = mustGetString(flags, flag.Name)
case "log":
ser.Log = mustGetString(flags, flag.Name)
case "publiclogin":
set.PublicLogin = mustGetBool(flags, flag.Name)
case "signup":
set.Signup = mustGetBool(flags, flag.Name)
case "auth.method":

View File

@ -320,6 +320,7 @@ func quickSetup(flags *pflag.FlagSet, d pythonData) {
set := &settings.Settings{
Key: generateKey(),
Signup: false,
PublicLogin: true,
CreateUserDir: false,
UserHomeBasePath: settings.DefaultUsersHomeBasePath,
Defaults: settings.UserDefaults{

View File

@ -60,6 +60,7 @@
</template>
<template v-else>
<router-link
v-if="publiclogin"
class="action"
to="/login"
:aria-label="$t('sidebar.login')"
@ -121,6 +122,7 @@ import * as auth from "@/utils/auth";
import {
version,
signup,
publiclogin,
disableExternal,
disableUsedPercentage,
noAuth,

View File

@ -18,6 +18,7 @@ const enableExec: boolean = window.FileBrowser.EnableExec;
const tusSettings = window.FileBrowser.TusSettings;
const origin = window.location.origin;
const tusEndpoint = `/api/tus`;
const publiclogin = window.FileBrowser.PublicLogin;
export {
name,
@ -39,4 +40,5 @@ export {
tusSettings,
origin,
tusEndpoint,
publiclogin
};

View File

@ -10,6 +10,7 @@ import (
type settingsData struct {
Signup bool `json:"signup"`
PublicLogin bool `json:"publiclogin"`
CreateUserDir bool `json:"createUserDir"`
UserHomeBasePath string `json:"userHomeBasePath"`
Defaults settings.UserDefaults `json:"defaults"`
@ -23,6 +24,7 @@ type settingsData struct {
var settingsGetHandler = withAdmin(func(w http.ResponseWriter, r *http.Request, d *data) (int, error) {
data := &settingsData{
Signup: d.settings.Signup,
PublicLogin: d.settings.PublicLogin,
CreateUserDir: d.settings.CreateUserDir,
UserHomeBasePath: d.settings.UserHomeBasePath,
Defaults: d.settings.Defaults,

View File

@ -46,6 +46,7 @@ func handleWithStaticData(w http.ResponseWriter, _ *http.Request, d *data, fSys
"ResizePreview": d.server.ResizePreview,
"EnableExec": d.server.EnableExec,
"TusSettings": d.settings.Tus,
"PublicLogin": d.settings.PublicLogin,
}
if d.settings.Branding.Files != "" {

View File

@ -18,6 +18,7 @@ type AuthMethod string
type Settings struct {
Key []byte `json:"key"`
Signup bool `json:"signup"`
PublicLogin bool `json:"publiclogin"`
CreateUserDir bool `json:"createUserDir"`
UserHomeBasePath string `json:"userHomeBasePath"`
Defaults UserDefaults `json:"defaults"`