<p>The submit action is the <strong>actionInput</strong> input <code>{{ actionInput('users/login') }}</code>.
This will call the login method of the <a href="https://github.com/craftcms/cms/blob/d19e2f549c58b1f6aded350b1ad6b8258c674bfa/src/controllers/UsersController.php#L121" rel="nofollow noreferrer">src/controllers/UsersController</a> and perform the action.</p>

<p>You may also take a look at <a href="https://docs.craftcms.com/api/v3/craft-elements-user.html" rel="nofollow noreferrer">User Element &amp; Events</a> where you can listen on various user events like <code>EVENT_BEFORE_VALIDATE</code>, <code>EVENT_BEFORE_AUTHENTICATE</code> etc.</p>

CC BY-SA 4.0
2019-11-15T14:52:13.233Z
I don't have the UsersController file in my project. How can I append my code into the UsersController file? So that I can edit the login action in order to create custom token and save it in user profile like here.
`$user->setFieldValue('token', $token);`
apollo
CC BY-SA 4.0
2019-11-15T15:01:45.793Z
Should I have to add this file?
https://github.com/craftcms/cms/blob/d19e2f549c58b1f6aded350b1ad6b8258c674bfa/src/controllers/UsersController.php
apollo
CC BY-SA 4.0
2019-11-15T15:10:12.920Z
I want to keep the login system and only append token to the current login. @christopher
apollo
CC BY-SA 4.0
2019-11-15T14:31:39.930Z
2019-11-15T14:31:39.930Z
Christopher Dosin
<p>I am building token auth system in Craft 3.
<a href="https://docs.craftcms.com/v3/dev/examples/login-form.html" rel="nofollow noreferrer">https://docs.craftcms.com/v3/dev/examples/login-form.html</a>
I used this Login Form.</p>

<p>Now I am going to create my own token and save it in user profile.</p>

<p>First problem is to link this Form Submit Action to my custom action.
I can not find the controller linked to this action.</p>

<p>How can I customize my login system? Where can I find the controller for the built-in login form logic?</p>

<craft3><php>
Custom Token Authentication with Craft 3 Login Form
# Custom Token Authentication with Craft 3 Login Form

(Asked by: username_0 on 2019-11-15)

I am building token auth system in Craft 3.
<https://docs.craftcms.com/v3/dev/examples/login-form.html>
I used this Login Form.

Now I am going to create my own token and save it in user profile.

First problem is to link this Form Submit Action to my custom action.
I can not find the controller linked to this action.

How can I customize my login system? Where can I find the controller for the built-in login form logic?

**Tags:** craft3, php


---

## 1 answers

### Answer by username_1 on 2019-11-15. Score: 3

The submit action is the **actionInput** input `{{ actionInput('users/login') }}`.
This will call the login method of the [src/controllers/UsersController](https://github.com/craftcms/cms/blob/d19e2f549c58b1f6aded350b1ad6b8258c674bfa/src/controllers/UsersController.php#L121) and perform the action.

You may also take a look at [User Element & Events](https://docs.craftcms.com/api/v3/craft-elements-user.html) where you can listen on various user events like `EVENT_BEFORE_VALIDATE`, `EVENT_BEFORE_AUTHENTICATE` etc.

> **Comments:**
> **username_0**: I don't have the UsersController file in my project. How can I append my code into the UsersController file? So that I can edit the login action in order to create custom token and save it in user profile like here. `$user->setFieldValue('token', $token);`  
> **username_0**: Should I have to add this file? https://github.com/craftcms/cms/blob/d19e2f549c58b1f6aded350b1ad6b8258c674bfa/src/controllers/UsersController.php  
> **username_0**: I want to keep the login system and only append token to the current login. @christopher  

---

