controllers/freeswitch: reorder the failure logic for no such user
This commit is contained in:
parent
2b05ef2c96
commit
70c130d978
|
@ -10,13 +10,14 @@ class Freeswitch extends lapis.Application
|
|||
POST: =>
|
||||
uid = @params["user"] or @params["sip_auth_username"]
|
||||
@user = Users\find extension: uid
|
||||
|
||||
if not @user
|
||||
return status: 404, layout: false, "no such user " .. uid
|
||||
|
||||
@tokens = Tokens\select "where user_id = ?", uid
|
||||
|
||||
if #@tokens == 0
|
||||
return status: 404, layout: false, "no auth tokens for " .. uid
|
||||
|
||||
if not @user
|
||||
return status: 404, layout: false, "no such user " .. uid
|
||||
|
||||
render: true, layout: false
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue