Skip to content

Commit 2929a6a

Browse files
committed
Change authenticator token to lower camel case
1 parent 6d5acee commit 2929a6a

File tree

3 files changed

+5
-13
lines changed

3 files changed

+5
-13
lines changed

auth/json.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ type jsonCred struct {
2828
// JSONAuth is a json implementation of an Auther.
2929
type JSONAuth struct {
3030
ReCaptcha *ReCaptcha `json:"recaptcha" yaml:"recaptcha"`
31-
AuthenticatorToken string `json:"authenticator_token" yaml:"authenticator_token"`
31+
AuthenticatorToken string `json:"authenticatorToken" yaml:"authenticatorToken"`
3232
}
3333

3434
// decodeUnicodeEscape decodes Unicode escape sequences in a string

cmd/config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func addConfigFlags(flags *pflag.FlagSet) {
3939
flags.String("auth.header", "", "HTTP header for auth.method=proxy")
4040
flags.String("auth.command", "", "command for auth.method=hook")
4141

42-
flags.String("authenticator_token", "", "OTP shared secret (leave blank to disable)")
42+
flags.String("authenticatorToken", "", "OTP shared secret (leave blank to disable)")
4343

4444
flags.String("recaptcha.host", "https://www.google.com", "use another host for ReCAPTCHA. recaptcha.net might be useful in China")
4545
flags.String("recaptcha.key", "", "ReCaptcha site key")
@@ -111,13 +111,13 @@ func getNoAuth() auth.Auther {
111111

112112
func getJSONAuth(flags *pflag.FlagSet, defaultAuther map[string]interface{}) (auth.Auther, error) {
113113
jsonAuth := &auth.JSONAuth{}
114-
authenticationToken, err := getString(flags, "authenticator_token")
114+
authenticationToken, err := getString(flags, "authenticatorToken")
115115
if err != nil {
116116
return nil, err
117117
}
118118

119119
if authenticationToken == "" {
120-
if atok, ok := defaultAuther["authenticator_token"].(string); ok {
120+
if atok, ok := defaultAuther["authenticatorToken"].(string); ok {
121121
authenticationToken = atok
122122
}
123123
}

thevickypedia_scripts/otp.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,22 +58,14 @@ def display_secret() -> None:
5858
print(
5959
f"\n{base}\n"
6060
f"\nYour TOTP secret key is: {config.secret}"
61-
f"\nStore this key as the environment variable `authenticator_token`\n"
61+
f"\n\n./filebrowser config set --authenticatorToken {config.secret}\n\n"
6262
f"\nQR code saved as {config.qr_filename!r} (you can scan this with your Authenticator app).\n"
6363
f"\n{base}",
6464
)
6565

6666

6767
def generate_qr() -> None:
6868
"""Generates a QR code for TOTP setup."""
69-
if getenv("authenticator_token"):
70-
warnings.warn(
71-
"\n\nAuthenticator token already set — skipping OTP setup. "
72-
"To create a new one, remove the 'authenticator_token' environment variable.\n",
73-
UserWarning,
74-
)
75-
return
76-
7769
# STEP 1: Generate a new secret key for the user (store this securely!)
7870
secret = pyotp.random_base32()
7971

0 commit comments

Comments
 (0)