Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
flrgh committed May 25, 2024
1 parent 4ae1f44 commit 686da1a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
1 change: 0 additions & 1 deletion lib/doorbell/policy/verify.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ local _M = {}
local http = require "doorbell.http"
local log = require "doorbell.log"
local const = require "doorbell.constants"
local email = require "doorbell.auth.email"

local ENDPOINT = const.endpoints.verify

Expand Down
10 changes: 3 additions & 7 deletions lib/doorbell/verify.lua
Original file line number Diff line number Diff line change
Expand Up @@ -259,17 +259,14 @@ local function verify_phone(ctx, args)
return send_json(400, "invalid telephone number")
end

local user = users.get_by_phone_number(tel) or {}
local user = users.get_by_phone_number(tel)
if not user then
delay()
return send_json(400, "invalid telephone number")
end

-- check verify
if args.code then
if true then
return send_json(200, "success, access granted")
end
local code = tostring(args.code)
local task, err = twilio.check_verify(tel, code)

Expand All @@ -294,9 +291,8 @@ local function verify_phone(ctx, args)
-- new verify
else
local addr = ctx.forwarded_addr or ctx.client_addr
--local task, err = twilio.new_verify_task(tel, addr)
--if task then
if true then
local task, err = twilio.new_verify_task(tel, addr)
if task then
return send_json(201, "Verification code sent. Please check your phone.", {
code_length = 6,
csrf = http.csrf.generate(),
Expand Down

0 comments on commit 686da1a

Please sign in to comment.