---
tags: [companyuser, controller]
module: CompanyUser
---

# AuthController

## Connections
[[_CompanyUser]] · [[[Model]User]] · [[[Service]UserServices]] · [[[Middleware]Middleware]] · [[[Routes]Routes]]

## Source
```
Modules/CompanyUser/Http/Controllers/Auth/LoginController.php
Modules/CompanyUser/Http/Controllers/Auth/RegisterController.php
Modules/CompanyUser/Http/Controllers/Auth/ChangePasswordController.php
Modules/CompanyUser/Http/Controllers/Auth/ForgotPasswordController.php
Modules/CompanyUser/Http/Controllers/Auth/ResetPasswordController.php
Modules/CompanyUser/Http/Controllers/Auth/VerificationController.php
Modules/CompanyUser/Http/Controllers/Api/AuthController.php
```

## Routes

| Method | URI | Controller | Middleware |
|---|---|---|---|
| GET | / | LoginController::showLoginForm | RedirectIfAuthenticated |
| POST | /login | LoginController::login | — |
| POST | /logout | LoginController::logout | auth |
| GET | /companyuser/register/{token} | RegisterController::showRegistrationForm | CheckFirstUser |
| GET | /companyuser/change-password | ChangePasswordController::index | auth |
| POST | /companyuser/change-password | ChangePasswordController::store | auth |
| POST | /password/email | ForgotPasswordController | guest |
| POST | /password/reset | ResetPasswordController | guest |
| GET | /email/verify | VerificationController | auth |
| POST | /v2/companyuser/auth/login | Api\AuthController::login | — |

## Validation Rules
- `MatchOldPassword` — old password must match current
- `DifferentPassword` — new password must differ from old

## API Response
`LoginResource` — user data + Sanctum API token
