# Destroy autofill when logout

**URL:** <https://discourse.cakephp.org/t/destroy-autofill-when-logout/8070>\
**Category:** Need Help\
**Created:** [July 16, 2020, 4:22am UTC](https://discourse.cakephp.org/t/destroy-autofill-when-logout/8070 "2020-07-16T04:22:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![arizzoye](https://avatars.discourse-cdn.com/v4/letter/a/f05b48/32.png) [@arizzoye](https://discourse.cakephp.org/u/arizzoye)\
**Post date:** [July 16, 2020, 4:22am UTC](https://discourse.cakephp.org/t/destroy-autofill-when-logout/8070/1 "2020-07-16T04:22:10Z")

</div>

good afternoon & happy launch with coffee.  
I have trouble when users have complete logout, while their try login it’s shown autofill email and password. Here’s below sample code in my `AppController.php`

```auto
    public function initialize()
    {
        parent::initialize();

        $this->loadComponent('RequestHandler', [
            'enableBeforeRedirect' => false,
        ]);
		//theme nasa
		$this->viewBuilder()->setTheme('Nasa');
		//autentikasi
		$this->loadComponent('Flash');
        $this->loadComponent('Auth', [
			'authorize' => 'Controller',
			'authenticate' => [
				'Form' => [
					'fields' => [
						'username' => 'Email',
						'password' => 'Password'
					]
				]
			],
			'loginAction' => [
				'controller' => 'Users',
				'action' => 'login'
			],
			'logoutRedirect' => [
				'controller' => 'Users',
				'action' => 'login'
			],
			//jika tidak sah, maka alihkan
			'unauthorizedRedirect' => $this->referer()
		]);
		//izinkan membaca
		$this->Auth->allow(['beranda', 'view', 'index']);
       }
	
	public function beforeFilter(Event $event)
	{
		$this->Auth->allow(['beranda', 'view', 'index']);
	}
	
	public function beforeRender(Event $event)
	{
		parent::beforeFilter($event);
		$this->set('userInfo', $this->Auth->user());
	}

```

I was browsing in stackoverflow  
[https://stackoverflow.com/questions/39074881/cakephp-3-auth-session-cannot-destroy](https://stackoverflow.com/questions/39074881/cakephp-3-auth-session-cannot-destroy)

and applying in my `AppController.php` code below

```auto
public function logout()
{
  $this->Auth->logout();
}

```

The result autofill email & password after logout still working, that could be dangerous in my app.  
I hope someone help me to fix destroy autofill when logout, thanx for help

---

<div class="post-metadata">

**Author:** ![bizdev](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/bizdev/32/1951_2.png) [@bizdev](https://discourse.cakephp.org/u/bizdev)\
**Post date:** [July 16, 2020, 11:45am UTC](https://discourse.cakephp.org/t/destroy-autofill-when-logout/8070/2 "2020-07-16T11:45:23Z")

</div>

Looks like the issue is with the controller and template code. Please share controller action and template code for login.

---

<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:** [July 16, 2020, 3:18pm UTC](https://discourse.cakephp.org/t/destroy-autofill-when-logout/8070/3 "2020-07-16T15:18:14Z")

</div>

This isn’t just standard browser behaviour remembering previous form information?

---

<div class="post-metadata">

**Author:** ![arizzoye](https://avatars.discourse-cdn.com/v4/letter/a/f05b48/32.png) [@arizzoye](https://discourse.cakephp.org/u/arizzoye)\
**Post date:** [July 18, 2020, 2:49pm UTC](https://discourse.cakephp.org/t/destroy-autofill-when-logout/8070/5 "2020-07-18T14:49:06Z")

</div>

thanks mr.Zuluru and bizdev, I’ve browsed and found to solve this problem in stack overflow, below this link

[https://stackoverflow.com/questions/14078067/jquery-disable-autocomplete-in-input/22257089](https://stackoverflow.com/questions/14078067/jquery-disable-autocomplete-in-input/22257089)

happy coding with coffee
