gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-taldir] branch master updated: add phone validator


From: gnunet
Subject: [taler-taldir] branch master updated: add phone validator
Date: Fri, 10 Jan 2025 10:29:55 +0100

This is an automated email from the git hooks/post-receive script.

martin-schanzenbach pushed a commit to branch master
in repository taldir.

The following commit(s) were added to refs/heads/master by this push:
     new 0ae04a9  add phone validator
0ae04a9 is described below

commit 0ae04a9722b7aaa1aca6db18b3ccf05cf7da6891
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Fri Jan 10 10:29:51 2025 +0100

    add phone validator
---
 scripts/validators/taldir-validate-phone | 45 ++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/scripts/validators/taldir-validate-phone 
b/scripts/validators/taldir-validate-phone
new file mode 100755
index 0000000..44151d1
--- /dev/null
+++ b/scripts/validators/taldir-validate-phone
@@ -0,0 +1,45 @@
+#!/bin/bash
+# This file is in the public domain.
+set -eu
+
+# Check shared secrets
+if [ -x "$TELESIGN_AUTH_TOKEN" ]
+then
+    echo "TELESIGN_AUTH_TOKEN not sent in environment"
+    exit 1
+fi
+
+USER_MAIL=$1
+CODE=$2
+LINK=$(taldir-cli -l -a $1 -c $2)
+
+MESSAGE="
+Hi,
+
+welcome to TalDir. You are almost there.
+Your registration code is $CODE.
+Follow this link to complete your Taldir registration: $LINK
+
+Best,
+TalDir
+"
+
+TMPFILE=$(mktemp /tmp/sms-loggingXXXXXX)
+STATUS=$(curl --request POST \
+     --url https://rest-api.telesign.com/v1/messaging \
+     --header "authorization: Basic $TELESIGN_AUTH_TOKEN" \
+     --header 'content-type: application/x-www-form-urlencoded' \
+     --data account_livecycle_event=transact \
+     --data "message=$MESSAGE" \
+     --data message_type=OTP \
+     --data "phone_number=$1" \
+     -w "%{http_code}" -s -o $TMPFILE)
+case $STATUS in
+    200|203|250|290|291|295)
+        exit 0;
+        ;;
+    *)
+        exit 1;
+        ;;
+esac
+exit 1

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]