[lime] LimeApp sharedPasswordLogin behavior

Üzenet törlése

Válasz az üzenetre
Szerző: Selan Kon
Dátum:  
Címzett: libremesh
Tárgy: [lime] LimeApp sharedPasswordLogin behavior
Hi,

Looking at the code of the limeapp > sharedPasswordLogin I have some
questions and improvements ideas, correct me if I mistake.

https://github.com/libremesh/lime-app/blob/53c44898d1f5ad18be0083153afab87a781fc848/src/containers/SharedPasswordLogin/sharedPasswordLogin.js#L67

The code:

```
const TryToLoginAutomatically = () => {
     const [login, {isError}] = useLogin();


     useEffect(() => {
         login({ username: "root", password: "" });
     }, [login]);


     if (isError) {
         return <SharedPasswordLoginHOC />;
     }
//...
```


Accessing to any window that needs a sharedPasswordLogin, do the following:

1. Call the mutation trying to login with `{ username: "root", password:
"" }`
2. Await a timeout of 5 seconds
https://github.com/libremesh/lime-app/blob/develop/src/utils/uhttpd.service.js#L52
3. If rejected shows the password screen.

I have some questions related and maybe code improvements:

- Is there a case where you can login as root without password? The FBW
always ask you for one, I supose, this use case is for those networks
that are not created by the FBW?
- Why to await 5 seconds, and not to return a "login failed" response
instead?

Thanks in advance