mirror of
https://github.com/simple-login/app.git
synced 2024-11-17 14:16:47 +08:00
variable naming
This commit is contained in:
parent
30183ac8c3
commit
4a0fc8380f
5 changed files with 10 additions and 10 deletions
|
@ -375,4 +375,4 @@ ALIAS_LIMIT = os.environ.get("ALIAS_LIMIT") or "100/day;50/hour;5/minute"
|
|||
|
||||
ENABLE_SPAM_ASSASSIN = "ENABLE_SPAM_ASSASSIN" in os.environ
|
||||
|
||||
ALIAS_RAND_SUFFIX_LENGTH = int(os.environ.get("ALIAS_RAND_SUFFIX_LENGTH", 5))
|
||||
ALIAS_RANDOM_SUFFIX_LENGTH = int(os.environ.get("ALIAS_RAND_SUFFIX_LENGTH", 5))
|
||||
|
|
|
@ -248,7 +248,7 @@
|
|||
<button class="btn btn-outline-primary">Update</button>
|
||||
</form>
|
||||
|
||||
<div class="mt-3 mb-1">Select the default suffix generator for aliases.</div>
|
||||
<div id="random-alias-suffix" class="mt-3 mb-1">Select the default suffix generator for aliases.</div>
|
||||
<form method="post" action="#random-alias-suffix" class="form-inline">
|
||||
<input type="hidden" name="form-name" value="random-alias-suffix">
|
||||
<select class="form-control mr-sm-2" name="random-alias-suffix-generator">
|
||||
|
|
|
@ -10,7 +10,7 @@ from app.config import (
|
|||
DISABLE_ALIAS_SUFFIX,
|
||||
CUSTOM_ALIAS_SECRET,
|
||||
ALIAS_LIMIT,
|
||||
ALIAS_RAND_SUFFIX_LENGTH,
|
||||
ALIAS_RANDOM_SUFFIX_LENGTH,
|
||||
)
|
||||
from app.dashboard.base import dashboard_bp
|
||||
from app.extensions import db, limiter
|
||||
|
@ -261,8 +261,8 @@ def get_suffix(user: User) -> str:
|
|||
Returns:
|
||||
str: the random suffix generated
|
||||
"""
|
||||
if user.random_alias_suffix == AliasSuffixEnum.rnd_string.value:
|
||||
return random_string(ALIAS_RAND_SUFFIX_LENGTH, include_digits=True)
|
||||
if user.random_alias_suffix == AliasSuffixEnum.random_string.value:
|
||||
return random_string(ALIAS_RANDOM_SUFFIX_LENGTH, include_digits=True)
|
||||
return random_word()
|
||||
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ from app.config import (
|
|||
URL,
|
||||
FIRST_ALIAS_DOMAIN,
|
||||
JOB_DELETE_ACCOUNT,
|
||||
ALIAS_RAND_SUFFIX_LENGTH,
|
||||
ALIAS_RANDOM_SUFFIX_LENGTH,
|
||||
)
|
||||
from app.dashboard.base import dashboard_bp
|
||||
from app.email_utils import (
|
||||
|
@ -306,7 +306,7 @@ def setting():
|
|||
apple_sub=apple_sub,
|
||||
coinbase_sub=coinbase_sub,
|
||||
FIRST_ALIAS_DOMAIN=FIRST_ALIAS_DOMAIN,
|
||||
ALIAS_RAND_SUFFIX_LENGTH=ALIAS_RAND_SUFFIX_LENGTH,
|
||||
ALIAS_RAND_SUFFIX_LENGTH=ALIAS_RANDOM_SUFFIX_LENGTH,
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@ class AliasGeneratorEnum(EnumE):
|
|||
|
||||
class AliasSuffixEnum(EnumE):
|
||||
word = 0 # Random word from dictionary file
|
||||
rnd_string = 1 # Completely random string
|
||||
random_string = 1 # Completely random string
|
||||
|
||||
|
||||
class Fido(db.Model, ModelMixin):
|
||||
|
@ -298,8 +298,8 @@ class User(db.Model, ModelMixin, UserMixin):
|
|||
random_alias_suffix = db.Column(
|
||||
db.Integer,
|
||||
nullable=False,
|
||||
default=AliasSuffixEnum.rnd_string.value,
|
||||
server_default=str(AliasSuffixEnum.rnd_string.value),
|
||||
default=AliasSuffixEnum.random_string.value,
|
||||
server_default=str(AliasSuffixEnum.random_string.value),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
|
|
Loading…
Reference in a new issue