variable naming

This commit is contained in:
devStorm 2021-05-14 11:03:16 -07:00
parent 30183ac8c3
commit 4a0fc8380f
No known key found for this signature in database
GPG key ID: D52E1B66F336AC57
5 changed files with 10 additions and 10 deletions

View file

@ -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))

View file

@ -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">

View file

@ -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()

View file

@ -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,
)

View file

@ -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