Skip to content

Commit

Permalink
b
Browse files Browse the repository at this point in the history
  • Loading branch information
polterguy committed Dec 25, 2023
1 parent fe5a2ec commit 7a1781b
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 1 deletion.
2 changes: 1 addition & 1 deletion backend/files/misc/workflows/actions/markdown2html.hl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
markdown
type:string
mandatory:bool:true
.icon:shield
.icon:pageview

// Transforming Markdown to HTML.
markdown2html:x:@.arguments/*/markdown
Expand Down
37 changes: 37 additions & 0 deletions backend/files/misc/workflows/actions/recaptcha.hl
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
16 changes: 16 additions & 0 deletions backend/files/misc/workflows/actions/send-email-from.hl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
body
type:textarea
mandatory:bool:true
html
type:bool
mandatory:bool:false
.icon:email

// Sanity checking invocation.
Expand All @@ -35,6 +38,19 @@ validators.email:x:@.arguments/*/from-email
validators.mandatory:x:@.arguments/*/subject
validators.mandatory:x:@.arguments/*/body

// Applying defaults.
validators.default:x:@.arguments
html:bool:false

// Making sure we send email as HTML if we should.
if
get-value:x:@.arguments/*/html
.lambda

// Making sure MIME message becomes HTML Content-Type.
set-value:x:../*/mail.smtp.send/**/entity
.:text/html

// Forward evaluating arguments to [mail.smtp.send].
unwrap:x:./*/mail.smtp.send/**

Expand Down

0 comments on commit 7a1781b

Please sign in to comment.