Compare commits
No commits in common. "b4ab4809c6c93e77542cab3f8bfe06d1416aeea0" and "489d64414e93bd2c66f67aad063cebe7e9f9449b" have entirely different histories.
b4ab4809c6
...
489d64414e
6 changed files with 13 additions and 45 deletions
4
Ideen.md
4
Ideen.md
|
@ -1,5 +1,6 @@
|
||||||
# MUSS
|
# MUSS
|
||||||
|
|
||||||
|
- api: admin Login case sensitivity (username "admin" == "AdMiN")
|
||||||
- api: Config-Liste von Extra-Türchen (kein Buchstabe, nur manuelles Bild)
|
- api: Config-Liste von Extra-Türchen (kein Buchstabe, nur manuelles Bild)
|
||||||
- api: Config-Option "Überspringe leere Türchen" (standard ja)
|
- api: Config-Option "Überspringe leere Türchen" (standard ja)
|
||||||
|
|
||||||
|
@ -7,6 +8,7 @@
|
||||||
|
|
||||||
- api/ui: Türchen mit Tag "0" einem zufälligen Tag zuweisen
|
- api/ui: Türchen mit Tag "0" einem zufälligen Tag zuweisen
|
||||||
- api/?: Option "custom Zuordnung Buchstaben" (standard leer)
|
- api/?: Option "custom Zuordnung Buchstaben" (standard leer)
|
||||||
|
- api: `config.solution` - whitespace="IGNORE"->"REMOVE" umbenennen, +Sonderzeichen
|
||||||
- ui: `confirm` durch bulma Komponente(n) ersetzen
|
- ui: `confirm` durch bulma Komponente(n) ersetzen
|
||||||
|
|
||||||
# Erledigt
|
# Erledigt
|
||||||
|
@ -18,5 +20,3 @@
|
||||||
- Option "Leerzeichen ignorieren" (standard ja)
|
- Option "Leerzeichen ignorieren" (standard ja)
|
||||||
- Nach einigen Sekunden: Meldung "Türchen anzeigen?"
|
- Nach einigen Sekunden: Meldung "Türchen anzeigen?"
|
||||||
- `alert` durch bulma Komponente(n) ersetzen
|
- `alert` durch bulma Komponente(n) ersetzen
|
||||||
- api: admin Login case sensitivity (username "admin" == "AdMiN")
|
|
||||||
- api: `config.solution` - whitespace="IGNORE"->"REMOVE" umbenennen, +Sonderzeichen
|
|
||||||
|
|
|
@ -23,18 +23,10 @@ class TransformedString(BaseModel):
|
||||||
# Leerzeichen an Anfang und Ende entfernen
|
# Leerzeichen an Anfang und Ende entfernen
|
||||||
STRIP = "STRIP"
|
STRIP = "STRIP"
|
||||||
|
|
||||||
# whitespace durch Leerzeichen ersetzen
|
|
||||||
SPACE = "SPACE"
|
|
||||||
|
|
||||||
# whitespace entfernen
|
# whitespace entfernen
|
||||||
REMOVE = "REMOVE"
|
IGNORE = "IGNORE"
|
||||||
|
|
||||||
class __SpecialChars(str, Enum):
|
# special chars
|
||||||
# unverändert
|
|
||||||
KEEP = "KEEP"
|
|
||||||
|
|
||||||
# Sonderzeichen entfernen
|
|
||||||
REMOVE = "REMOVE"
|
|
||||||
|
|
||||||
class __Case(str, Enum):
|
class __Case(str, Enum):
|
||||||
# unverändert
|
# unverändert
|
||||||
|
@ -51,8 +43,7 @@ class TransformedString(BaseModel):
|
||||||
|
|
||||||
value: str
|
value: str
|
||||||
|
|
||||||
whitespace: __Whitespace = __Whitespace.REMOVE
|
whitespace: __Whitespace = __Whitespace.IGNORE
|
||||||
special_chars: __SpecialChars = __SpecialChars.REMOVE
|
|
||||||
case: __Case = __Case.UPPER
|
case: __Case = __Case.UPPER
|
||||||
|
|
||||||
@field_validator("whitespace", "case", mode="before")
|
@field_validator("whitespace", "case", mode="before")
|
||||||
|
@ -63,28 +54,21 @@ class TransformedString(BaseModel):
|
||||||
def clean(self) -> str:
|
def clean(self) -> str:
|
||||||
result = self.value
|
result = self.value
|
||||||
|
|
||||||
# Whitespace verarbeiten
|
# Whitespace bearbeiten
|
||||||
if self.whitespace is TransformedString.__Whitespace.STRIP:
|
if self.whitespace is self.__Whitespace.STRIP:
|
||||||
result = result.strip()
|
result = result.strip()
|
||||||
|
|
||||||
elif self.whitespace is TransformedString.__Whitespace.SPACE:
|
elif self.whitespace is self.__Whitespace.IGNORE:
|
||||||
result = re.sub(string=result, pattern=r"\s+", repl="")
|
result = re.sub(string=result, pattern=r"\s+", repl="")
|
||||||
|
|
||||||
elif self.whitespace is TransformedString.__Whitespace.REMOVE:
|
|
||||||
result = re.sub(string=result, pattern=r"\s+", repl="")
|
|
||||||
|
|
||||||
# Sonderzeichen verarbeiten
|
|
||||||
if self.special_chars is TransformedString.__SpecialChars.REMOVE:
|
|
||||||
result = re.sub(string=result, pattern=r"[^a-zA-Z0-9\s]+", repl="")
|
|
||||||
|
|
||||||
# Groß-/Kleinschreibung verarbeiten
|
# Groß-/Kleinschreibung verarbeiten
|
||||||
if self.case is TransformedString.__Case.UPPER:
|
if self.case is self.__Case.UPPER:
|
||||||
result = result.upper()
|
result = result.upper()
|
||||||
|
|
||||||
elif self.case is TransformedString.__Case.LOWER:
|
elif self.case is self.__Case.LOWER:
|
||||||
result = result.lower()
|
result = result.lower()
|
||||||
|
|
||||||
elif self.case is TransformedString.__Case.RANDOM:
|
elif self.case is self.__Case.RANDOM:
|
||||||
rnd = Random(self.value)
|
rnd = Random(self.value)
|
||||||
|
|
||||||
def randomcase(c: str) -> str:
|
def randomcase(c: str) -> str:
|
||||||
|
|
|
@ -19,14 +19,8 @@ async def user_is_admin(
|
||||||
True iff der user "admin" ist
|
True iff der user "admin" ist
|
||||||
"""
|
"""
|
||||||
|
|
||||||
username_correct = secrets.compare_digest(
|
username_correct = secrets.compare_digest(credentials.username, cfg.admin.name)
|
||||||
credentials.username.lower(),
|
password_correct = secrets.compare_digest(credentials.password, cfg.admin.password)
|
||||||
cfg.admin.name.lower(),
|
|
||||||
)
|
|
||||||
password_correct = secrets.compare_digest(
|
|
||||||
credentials.password,
|
|
||||||
cfg.admin.password,
|
|
||||||
)
|
|
||||||
|
|
||||||
return username_correct and password_correct
|
return username_correct and password_correct
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,6 @@ class AdminConfigModel(BaseModel):
|
||||||
class __Solution(BaseModel):
|
class __Solution(BaseModel):
|
||||||
value: str
|
value: str
|
||||||
whitespace: str
|
whitespace: str
|
||||||
special_chars: str
|
|
||||||
case: str
|
case: str
|
||||||
clean: str
|
clean: str
|
||||||
|
|
||||||
|
@ -82,7 +81,6 @@ async def get_config_model(
|
||||||
"solution": {
|
"solution": {
|
||||||
"value": cfg.solution.value,
|
"value": cfg.solution.value,
|
||||||
"whitespace": cfg.solution.whitespace,
|
"whitespace": cfg.solution.whitespace,
|
||||||
"special_chars": cfg.solution.special_chars,
|
|
||||||
"case": cfg.solution.case,
|
"case": cfg.solution.case,
|
||||||
"clean": cfg.solution.clean,
|
"clean": cfg.solution.clean,
|
||||||
},
|
},
|
||||||
|
|
|
@ -27,12 +27,6 @@
|
||||||
{{ admin_config_model.solution.whitespace }}
|
{{ admin_config_model.solution.whitespace }}
|
||||||
</span>
|
</span>
|
||||||
</dd>
|
</dd>
|
||||||
<dd>
|
|
||||||
Sonderzeichen:
|
|
||||||
<span class="is-uppercase is-family-monospace">
|
|
||||||
{{ admin_config_model.solution.special_chars }}
|
|
||||||
</span>
|
|
||||||
</dd>
|
|
||||||
<dd>
|
<dd>
|
||||||
Buchstaben:
|
Buchstaben:
|
||||||
<span class="is-uppercase is-family-monospace">
|
<span class="is-uppercase is-family-monospace">
|
||||||
|
@ -190,7 +184,6 @@ export default class extends Vue {
|
||||||
solution: {
|
solution: {
|
||||||
value: "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
value: "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
||||||
whitespace: "KEEP",
|
whitespace: "KEEP",
|
||||||
special_chars: "KEEP",
|
|
||||||
case: "KEEP",
|
case: "KEEP",
|
||||||
clean: "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
clean: "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
||||||
},
|
},
|
||||||
|
|
|
@ -2,7 +2,6 @@ export interface AdminConfigModel {
|
||||||
solution: {
|
solution: {
|
||||||
value: string;
|
value: string;
|
||||||
whitespace: string;
|
whitespace: string;
|
||||||
special_chars: string;
|
|
||||||
case: string;
|
case: string;
|
||||||
clean: string;
|
clean: string;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue