A question regarding the Auth plugin

Hello,

My question is

This is the standard code for the authentication plugin

$result = $this->Authentication->getResult();

  // regardless of POST or GET, redirect if user is logged in

    if ($result->isValid()) {

      $redirect = $this->request->getQuery('redirect', [

          'controller' => 'Files',

          'action' => 'index',

    ]);

.My question is, is there a way to fill in the details not from the form, but maybe from the login method itself? e.g setting the password to always be ‘randompassword’? I tried messing with the middleware looking up but didn’t find any answer, thanks.

To give context, I am trying to authenticate an email to someone who just fills out a form with his email, no password needed. How can I set that session and make him logged in? I tried to use the deprecated Auth component but it broke my site lol.

I will have 2 versions of login, one with just email
other with email and password

Thanks for the reply, I should have been more clear. I am talking about the Authentication plugin not the Auth one.
I tried the Auth one but it broke my site plus it’s deprecated.

Sorry, the link goes to the first answer on that question, but it’s the second answer that applies to the Authentication plugin.

Oh my bad, I’ll check it out soon thanks!