-
-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
54 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
|
||
/* | ||
* Validates the specified reCAPTCHA token. | ||
* | ||
* This action will validate the specified reCAPTCHA token and throw an exception if validation fails, | ||
* unless the user is authenticated and belongs to the root role. | ||
*/ | ||
.arguments | ||
recaptcha_token | ||
type:string | ||
mandatory:bool:true | ||
.icon:shield | ||
|
||
/* | ||
* Checking if backend is configured to use reCAPTCHA, and if so, | ||
* making sure we ensure the frontend supplied a [recaptcha_token], | ||
* and invoking slot responsible for verifying reCAPTCHA value. | ||
*/ | ||
auth.ticket.get | ||
config.get:"magic:auth:recaptcha:key" | ||
if | ||
and | ||
not-null:x:@config.get | ||
neq:x:@config.get | ||
.: | ||
not-exists:x:@auth.ticket.get/*/roles/*/=root | ||
.lambda | ||
|
||
// [recaptcha_token] is a mandatory field. | ||
validators.mandatory:x:@.arguments/*/recaptcha_token | ||
|
||
// Retrieving secret and invoking slot responsible for verifying reCAPTCHA value. | ||
config.get:"magic:auth:recaptcha:secret" | ||
validators.recaptcha:x:@.arguments/*/recaptcha_token | ||
min:decimal:0.3 | ||
site-key:x:@config.get/@config.get | ||
secret:x:@config.get |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters