add ip address to the auth
Some checks failed
Build and push image for doorman / docker (push) Failing after 2m40s
Some checks failed
Build and push image for doorman / docker (push) Failing after 2m40s
This commit is contained in:
parent
0bac206bdd
commit
9aaa639d8d
@ -27,8 +27,18 @@ export const AuthComponent = ({ door, secret, authMode, onError, onUnlock, runCh
|
|||||||
}
|
}
|
||||||
}, [runCheck])
|
}, [runCheck])
|
||||||
|
|
||||||
const onSubmit = () => {
|
const onSubmit = async () => {
|
||||||
fetch(`/api/door/auth?key=${key}&rotatingKey=${key}&door=${door}`)
|
const ip = await fetch('https://api.ipify.org?format=json')
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
return data.ip;
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.log('Error:', error);
|
||||||
|
return "null";
|
||||||
|
});
|
||||||
|
|
||||||
|
fetch(`/api/door/auth?key=${key}&rotatingKey=${key}&door=${door}&ip=${ip}`)
|
||||||
.then(async res => {
|
.then(async res => {
|
||||||
if (res.status !== 200) {
|
if (res.status !== 200) {
|
||||||
setError("Incorrect PIN");
|
setError("Incorrect PIN");
|
||||||
|
|||||||
@ -9,12 +9,12 @@ export default defineConfig({
|
|||||||
server: {
|
server: {
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': {
|
'/api': {
|
||||||
target: 'http://localhost:5000',
|
target: 'http://localhost:3000',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
host: "0.0.0.0",
|
host: "0.0.0.0",
|
||||||
port: 3000
|
port: 8080
|
||||||
},
|
},
|
||||||
build: {
|
build: {
|
||||||
outDir: "dist",
|
outDir: "dist",
|
||||||
|
|||||||
@ -34,6 +34,7 @@ exports.handler = async function(context, event, callback) {
|
|||||||
const fingerprint = {
|
const fingerprint = {
|
||||||
method: "PIN",
|
method: "PIN",
|
||||||
userAgent: event.request.headers['user-agent'],
|
userAgent: event.request.headers['user-agent'],
|
||||||
|
ip: event.ip,
|
||||||
};
|
};
|
||||||
|
|
||||||
// take timeout from the query string
|
// take timeout from the query string
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user