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])
|
||||
|
||||
const onSubmit = () => {
|
||||
fetch(`/api/door/auth?key=${key}&rotatingKey=${key}&door=${door}`)
|
||||
const onSubmit = async () => {
|
||||
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 => {
|
||||
if (res.status !== 200) {
|
||||
setError("Incorrect PIN");
|
||||
|
||||
@ -9,12 +9,12 @@ export default defineConfig({
|
||||
server: {
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'http://localhost:5000',
|
||||
target: 'http://localhost:3000',
|
||||
changeOrigin: true,
|
||||
},
|
||||
},
|
||||
host: "0.0.0.0",
|
||||
port: 3000
|
||||
port: 8080
|
||||
},
|
||||
build: {
|
||||
outDir: "dist",
|
||||
|
||||
@ -34,6 +34,7 @@ exports.handler = async function(context, event, callback) {
|
||||
const fingerprint = {
|
||||
method: "PIN",
|
||||
userAgent: event.request.headers['user-agent'],
|
||||
ip: event.ip,
|
||||
};
|
||||
|
||||
// take timeout from the query string
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user