Flash localized messages from auth
This commit is contained in:
parent
934f7ae676
commit
21f1035b66
@ -14,9 +14,9 @@ def register():
|
|||||||
error = None
|
error = None
|
||||||
|
|
||||||
if not username:
|
if not username:
|
||||||
error = "Username is required."
|
error = "username_required"
|
||||||
elif not password:
|
elif not password:
|
||||||
error = "Password is required."
|
error = "password_required"
|
||||||
|
|
||||||
if error is None:
|
if error is None:
|
||||||
try:
|
try:
|
||||||
@ -46,9 +46,9 @@ def login():
|
|||||||
).fetchone()
|
).fetchone()
|
||||||
|
|
||||||
if user is None:
|
if user is None:
|
||||||
error = "Incorrect username."
|
error = "incorrect_username"
|
||||||
elif not check_password_hash(user["password"], password):
|
elif not check_password_hash(user["password"], password):
|
||||||
error = "Incorrect password."
|
error = "incorrect_password"
|
||||||
|
|
||||||
if error is None:
|
if error is None:
|
||||||
session.clear()
|
session.clear()
|
||||||
|
@ -12,7 +12,9 @@ EXISTING_STRINGS = {
|
|||||||
"search",
|
"search",
|
||||||
"search_placeholder",
|
"search_placeholder",
|
||||||
"include_kanji",
|
"include_kanji",
|
||||||
"include_kotoba"
|
"include_kotoba",
|
||||||
|
"username_required",
|
||||||
|
"password_required"
|
||||||
}
|
}
|
||||||
|
|
||||||
ENGLISH = {
|
ENGLISH = {
|
||||||
@ -29,7 +31,11 @@ ENGLISH = {
|
|||||||
"search": "Search",
|
"search": "Search",
|
||||||
"search_placeholder": "Enter kanji or word",
|
"search_placeholder": "Enter kanji or word",
|
||||||
"include_kanji": "Include kanji",
|
"include_kanji": "Include kanji",
|
||||||
"include_kotoba": "Include kotoba"
|
"include_kotoba": "Include kotoba",
|
||||||
|
"username_required": "Username required.",
|
||||||
|
"password_required": "Password required.",
|
||||||
|
"incorrect_username": "Incorrect username.",
|
||||||
|
"incorrect_password": "Incorrect password."
|
||||||
}
|
}
|
||||||
|
|
||||||
JAPANESE = {
|
JAPANESE = {
|
||||||
@ -47,6 +53,10 @@ JAPANESE = {
|
|||||||
"search_placeholder": "漢字・言葉を入力",
|
"search_placeholder": "漢字・言葉を入力",
|
||||||
"include_kanji": "漢字を含む",
|
"include_kanji": "漢字を含む",
|
||||||
"include_kotoba": "言葉を含む",
|
"include_kotoba": "言葉を含む",
|
||||||
|
"username_required": "ユーザー名が必要です",
|
||||||
|
"password_required": "パスワードが必要です",
|
||||||
|
"incorrect_username": "ユーザー名が違います",
|
||||||
|
"incorrect_password": "パスワードが違います"
|
||||||
}
|
}
|
||||||
|
|
||||||
LANGUAGES = [
|
LANGUAGES = [
|
||||||
|
Loading…
Reference in New Issue
Block a user