diff --git a/lib/doorbell/policy/verify.lua b/lib/doorbell/policy/verify.lua index 3e964461..80a4bb40 100644 --- a/lib/doorbell/policy/verify.lua +++ b/lib/doorbell/policy/verify.lua @@ -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 diff --git a/lib/doorbell/verify.lua b/lib/doorbell/verify.lua index 674be1e6..24b65d85 100644 --- a/lib/doorbell/verify.lua +++ b/lib/doorbell/verify.lua @@ -259,7 +259,7 @@ 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") @@ -267,9 +267,6 @@ local function verify_phone(ctx, args) -- 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) @@ -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(),