refactor(scanner): finished login stuff for current routes
This commit is contained in:
@@ -15,9 +15,11 @@ export default function TabsLayout() {
|
||||
const isUnlocked = useMobileAuthStore((s) => s.isUnlocked);
|
||||
|
||||
const port = parseInt(serverPort || "0", 10) >= 50000;
|
||||
|
||||
if (!user || (!isUnlocked && !port)) {
|
||||
return <Redirect href="/login" />;
|
||||
console.log(port);
|
||||
if (!port) {
|
||||
if (!user || !isUnlocked) {
|
||||
return <Redirect href="/login" />;
|
||||
}
|
||||
}
|
||||
|
||||
const isNormalScanner = parseInt(serverPort || "0", 10) >= 50000;
|
||||
|
||||
@@ -2,7 +2,7 @@ import axios from "axios";
|
||||
|
||||
import { useRouter } from "expo-router";
|
||||
import { useState } from "react";
|
||||
import { Button, Text, View } from "react-native";
|
||||
import { Alert, Button, Text, View } from "react-native";
|
||||
import { Input } from "../components/ui/input";
|
||||
import { useAppStore } from "../hooks/useAppStore";
|
||||
import { useMobileAuthStore } from "../hooks/useMobileAuth";
|
||||
@@ -38,6 +38,7 @@ export default function Login() {
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
Alert.alert("Login Error", `Invalid pin please try again`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -70,7 +71,7 @@ export default function Login() {
|
||||
</View>
|
||||
</View>
|
||||
<View>
|
||||
<Text>
|
||||
<Text className="p-3">
|
||||
Warning: If you are logged into another scanner you will encounter
|
||||
scan errors, please do not try to log into more than 1 scanner at a
|
||||
time.
|
||||
|
||||
@@ -25,6 +25,8 @@ export default function Setup() {
|
||||
|
||||
const server = useServerStore((s) => s.serverVersion);
|
||||
|
||||
// TODO: if on lst version and the user is manager or admin just login
|
||||
|
||||
const authCheck = () => {
|
||||
if (pin === "6971") {
|
||||
setAuth(true);
|
||||
|
||||
Reference in New Issue
Block a user