feat(sddm): disable button when password isn't filled
This commit is contained in:
@@ -47,7 +47,7 @@ export const Sddm = () => {
|
|||||||
const canType =
|
const canType =
|
||||||
password < 4 ||
|
password < 4 ||
|
||||||
password === PASSWORD_LENGTH - 1 ||
|
password === PASSWORD_LENGTH - 1 ||
|
||||||
Math.random() > 0.2;
|
Math.random() > 0.15;
|
||||||
setPassword(Math.max(0, password + (canType ? 1 : -1)));
|
setPassword(Math.max(0, password + (canType ? 1 : -1)));
|
||||||
},
|
},
|
||||||
password === 0 ? 1000 : Math.random() * 250 + 100,
|
password === 0 ? 1000 : Math.random() * 250 + 100,
|
||||||
@@ -127,12 +127,9 @@ export const Sddm = () => {
|
|||||||
|
|
||||||
<div className="flex min-w-[210px] flex-col gap-1 text-left transition-colors lg:w-1/2">
|
<div className="flex min-w-[210px] flex-col gap-1 text-left transition-colors lg:w-1/2">
|
||||||
<button
|
<button
|
||||||
|
disabled={password !== PASSWORD_LENGTH}
|
||||||
onClick={() => setState("desktop")}
|
onClick={() => setState("desktop")}
|
||||||
className={`w-full select-none rounded-full p-2 ${
|
className="w-full select-none rounded-full bg-neutral-800 p-2 hover:bg-zinc-800 disabled:cursor-default disabled:bg-white disabled:bg-opacity-30"
|
||||||
password === PASSWORD_LENGTH
|
|
||||||
? "bg-neutral-800 hover:bg-zinc-800"
|
|
||||||
: "cursor-default bg-white bg-opacity-30"
|
|
||||||
}`}
|
|
||||||
>
|
>
|
||||||
Login
|
Login
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user