260904_01_ENH: 로그인 화면에 ip와 자리번호 노출
This commit is contained in:
@@ -9,17 +9,25 @@ import {useRouter} from "next/navigation";
|
|||||||
import {apiError} from "@kri/common/http";
|
import {apiError} from "@kri/common/http";
|
||||||
import {NONE_HTTP_ERROR} from "@kri/common/http";
|
import {NONE_HTTP_ERROR} from "@kri/common/http";
|
||||||
import {useLoginMutation} from "@/query/auth";
|
import {useLoginMutation} from "@/query/auth";
|
||||||
|
import {useInternalInfoQuery} from "@/query/internal";
|
||||||
|
import {cn} from "@/lib/utils";
|
||||||
|
|
||||||
const LoginPage = () => {
|
const LoginPage = () => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const loginMutation = useLoginMutation();
|
const loginMutation = useLoginMutation();
|
||||||
|
const internalInfoQuery = useInternalInfoQuery(true);
|
||||||
|
|
||||||
const [error, setError] = useState<string | null>(null);
|
const [error, setError] = useState<string | null>(null);
|
||||||
|
|
||||||
const [userId, setUserId] = useState<string>("");
|
const [userId, setUserId] = useState<string>("");
|
||||||
const [userPw, setUserPw] = useState<string>("");
|
const [userPw, setUserPw] = useState<string>("");
|
||||||
|
|
||||||
|
const clientIp = internalInfoQuery.data?.clientIp || "";
|
||||||
|
const clientId = internalInfoQuery.data?.clientId || "";
|
||||||
|
const isCallSeat = clientIp.startsWith("10.10.15");
|
||||||
|
const isCallSeatAndUnable = isCallSeat && clientId === "";
|
||||||
|
|
||||||
const passwordInputRef = useRef<HTMLInputElement | null>(null);
|
const passwordInputRef = useRef<HTMLInputElement | null>(null);
|
||||||
|
|
||||||
const tryLogin = async () => {
|
const tryLogin = async () => {
|
||||||
@@ -107,7 +115,12 @@ const LoginPage = () => {
|
|||||||
ref={passwordInputRef}
|
ref={passwordInputRef}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<p className="text-base">
|
||||||
|
IP: {clientIp}
|
||||||
|
</p>
|
||||||
|
<p className={cn("text-base", isCallSeatAndUnable && "font-bold text-red-500")}>
|
||||||
|
{isCallSeatAndUnable? "전화걸기 이용 불가(관리자에게 문의해 주세요)" : `자리번호: ${clientId}`}
|
||||||
|
</p>
|
||||||
{error && (
|
{error && (
|
||||||
<p className="text-sm text-red-500">
|
<p className="text-sm text-red-500">
|
||||||
{error}
|
{error}
|
||||||
@@ -116,7 +129,7 @@ const LoginPage = () => {
|
|||||||
|
|
||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
className="w-full mt-6 h-11"
|
className="w-full mt-3 h-11"
|
||||||
disabled={loginMutation.isPending}
|
disabled={loginMutation.isPending}
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|||||||
Reference in New Issue
Block a user