local twilio = require('twilio')
function sendpin(phonenumber, pin)
local ACCOUNTSID = ''
local AUTHTOKEN = ''
local response = twilio.sms(ACCOUNTSID, AUTHTOKEN,
'+14259678361', request.form.phonenumber,
'webscript.io example PIN: '..pin)
return response.statuscode == 201
end
if request.form.phonenumber then
local id = math.random(1000, 9999)
local pin = math.random(1000, 9999)
storage['id:'..id] = pin
sendpin(request.form.phonenumber, pin)
return {id=id}
elseif request.form.pin == storage['id:'..request.form.id] then
storage['id:'..request.form.id] = nil
return "Verification successful!"
else
return "Invalid PIN."
end
ليست هناك تعليقات:
إرسال تعليق