getkirby / demokit

A demo setup for trykirby.com
https://trykirby.com
25 stars 12 forks source link

Prefill Panel login #29

Closed distantnative closed 4 years ago

bastianallgeier commented 4 years ago

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.

distantnative commented 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...

johannschopplich commented 4 years ago

Just an idea which you probably fiddled with already: Watching for the route path "login" and then using the next tick function?

distantnative commented 4 years ago

@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

johannschopplich commented 4 years ago

I see... I assumed you thought of this. Just wanted to get rid of the thought.

distantnative commented 4 years ago

Maybe we should use our power and better add a global login.ready event to the core.

bastianallgeier commented 4 years ago

Another idea: we could create a custom login view component in a plugin and use that to fill in the credentials.

distantnative commented 4 years ago

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.

lukasbestle commented 4 years ago

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?

bastianallgeier commented 4 years ago

@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.

lukasbestle commented 4 years ago

Very true!