Closed distantnative closed 4 years ago
Modified it a bit. Unfortunately there doesn't seem to be a good way to neither detect if the LoginView is the current view, nor detect when all subcomponents have been mounted.
So it has a very ugly setTimeout...
Just an idea which you probably fiddled with already: Watching for the route path "login" and then using the next tick function?
@johannschopplich the problem is that if you navigate to the page instead of reloading the route is still „/„ snd not yet „/login“.
Plus, nextTick doesn’t get you to the time all components are mounted. Even multiple nextTicks didn’t
I see... I assumed you thought of this. Just wanted to get rid of the thought.
Maybe we should use our power and better add a global login.ready
event to the core.
Another idea: we could create a custom login view component in a plugin and use that to fill in the credentials.
I tried that first... but because you import the standard login directly in the core, we cannot extend it. So we would need to copy the whole code and that didn't feel DRY or right.
Another idea: We could log the first user of the demo (= the one who created it) in automatically. A session is already created for that user for the IP address check, so we might as well manually store the user ID in the session as well. What do you think from the UX perspective?
@lukasbestle I thought about this as well, but it might feel strange and give the impression that Kirby isn't secure – which is of course bullshit. But I guess it's important to have the login at that point – even if it's prefilled.
Very true!
Hm, somehow it only works when I reload the panel. When I navigate to the panel from the button in the demo, the prefill doesn't work.