# A question regarding the Auth plugin

**URL:** <https://discourse.cakephp.org/t/a-question-regarding-the-auth-plugin/8773>\
**Category:** Need Help\
**Created:** [December 23, 2020, 10:55pm UTC](https://discourse.cakephp.org/t/a-question-regarding-the-auth-plugin/8773 "2020-12-23T22:55:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![noobcakephp](https://avatars.discourse-cdn.com/v4/letter/n/ce73a5/32.png) [@noobcakephp](https://discourse.cakephp.org/u/noobcakephp)\
**Post date:** [December 23, 2020, 10:55pm UTC](https://discourse.cakephp.org/t/a-question-regarding-the-auth-plugin/8773/1 "2020-12-23T22:55:25Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![noobcakephp](https://avatars.discourse-cdn.com/v4/letter/n/ce73a5/32.png) [@noobcakephp](https://discourse.cakephp.org/u/noobcakephp)\
**Post date:** [December 23, 2020, 11:03pm UTC](https://discourse.cakephp.org/t/a-question-regarding-the-auth-plugin/8773/2 "2020-12-23T23:03:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Zuluru](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/zuluru/32/1230_2.png) [@Zuluru](https://discourse.cakephp.org/u/Zuluru)\
**Post date:** [December 24, 2020, 2:50am UTC](https://discourse.cakephp.org/t/a-question-regarding-the-auth-plugin/8773/3 "2020-12-24T02:50:31Z")

</div>

> <https://stackoverflow.com/questions/28751031/cakephp-3-how-to-automatically-log-a-user-in-after-registration/28751378#28751378>

---

<div class="post-metadata">

**Author:** ![noobcakephp](https://avatars.discourse-cdn.com/v4/letter/n/ce73a5/32.png) [@noobcakephp](https://discourse.cakephp.org/u/noobcakephp)\
**Post date:** [December 24, 2020, 9:15am UTC](https://discourse.cakephp.org/t/a-question-regarding-the-auth-plugin/8773/4 "2020-12-24T09:15:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Zuluru](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/zuluru/32/1230_2.png) [@Zuluru](https://discourse.cakephp.org/u/Zuluru)\
**Post date:** [December 24, 2020, 3:31pm UTC](https://discourse.cakephp.org/t/a-question-regarding-the-auth-plugin/8773/5 "2020-12-24T15:31:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![noobcakephp](https://avatars.discourse-cdn.com/v4/letter/n/ce73a5/32.png) [@noobcakephp](https://discourse.cakephp.org/u/noobcakephp)\
**Post date:** [December 24, 2020, 4:00pm UTC](https://discourse.cakephp.org/t/a-question-regarding-the-auth-plugin/8773/6 "2020-12-24T16:00:49Z")

</div>

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