1

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?

2

The submit action is the actionInput input {{ actionInput('users/login') }}. This will call the login method of the src/controllers/UsersController and perform the action.

You may also take a look at User Element & Events where you can listen on various user events like EVENT_BEFORE_VALIDATE, EVENT_BEFORE_AUTHENTICATE etc.

| improve this answer | |
  • 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 Nov 15 '19 at 14:52
  • Should I have to add this file? github.com/craftcms/cms/blob/… – apollo Nov 15 '19 at 15:01
  • I want to keep the login system and only append token to the current login. @christopher – apollo Nov 15 '19 at 15:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.