Skip to content

Commit

Permalink
captcha_lib: added lang strings (kki) (#359)
Browse files Browse the repository at this point in the history
  • Loading branch information
drfho authored Feb 1, 2025
1 parent f1fa9b5 commit e8fe6cd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Products/zms/conf/metaobj_manager/captcha_lib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,21 @@ class captcha_lib:
# Id
id = "captcha_lib"

# Lang_dict
lang_dict = {"captcha_lib.captcha_hint":{"ger":"Bitte geben Sie nun abschliessend folgende vier-stellige Prüfziffer zum Schutz vor Spam in das weisse Feld ein; beachten Sie, dass sich die Prüfziffer alle zwei Minuten erneuert. Durch Klick auf das blaue Stoppuhr-Symbol \"Reload\" können Sie jederzeit eine erneut zwei Minuten gütige Prüfziffer anfordern."}
,"captcha_lib.captcha_input":{"ger":"Bitte Prüfziffer eingeben und absenden."}
,"captcha_lib.captcha_invalid":{"ger":"Leider ist die Eingabe der Prüfziffer nicht korrekt; bitte betätigen Sie die \"Zurück\"-Taste des Webbrowsers und versuchen Sie es bitte nochmals."}
,"captcha_lib.captcha_reload":{"ger":"Erneuern"}
,"captcha_lib.captcha_valid":{"ger":"Prüfziffer korrekt."}}

# Name
name = "Captcha-Lib"

# Package
package = ""

# Revision
revision = "0.4.0"
revision = "0.5.0"

# Type
type = "ZMSLibrary"
Expand Down
4 changes: 4 additions & 0 deletions Products/zms/conf/metaobj_manager/captcha_lib/captcha_js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var $captcha_timer
async function captcha_create() {
const response = await fetch('./captcha_create')
const responseJSON = await response.json()
document.getElementById('captcha_str').setAttribute('class','form-control')
document.getElementById('captcha_data_uri').setAttribute('src', responseJSON.captcha_data_uri)
document.getElementById('signature').setAttribute('value', responseJSON.signature)
document.getElementById('life_time').setAttribute('value', responseJSON.life_time)
Expand All @@ -39,9 +40,12 @@ async function captcha_validate() {
const response = await fetch('./captcha_validate' + url_params, settings)
const responseJSON = await response.json()
if (responseJSON.captcha_is_valid) {
document.getElementById('captcha_str').setAttribute('class','form-control alert-success')
document.getElementById('captcha_is_valid').setAttribute('class','alert alert-success')
document.getElementById('captcha_is_valid').innerHTML = 'True'
return true
} else {
document.getElementById('captcha_str').setAttribute('class','form-control alert-danger')
document.getElementById('captcha_is_valid').setAttribute('class','alert alert-danger')
document.getElementById('captcha_is_valid').innerHTML = 'False'
}
Expand Down
1 change: 1 addition & 0 deletions Products/zms/conf/metaobj_manager/captcha_lib/readme
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ The Lib consists of four elements:
The TAL-Templates is considered as working example form that contains the HTML elements and JS-functions that are needed to integrate the functionality to your own forms.

The following ZMS configuration properties are used by the Captcha Lib:

1. `ZMS.captcha.secret_key`: secret key for signinng the captcha
2. `ZMS.captcha.life_time`: life time of the captcha
3. `ZMS.captcha.font_path`: os path of the applied font
Expand Down

0 comments on commit e8fe6cd

Please sign in to comment.