amnah / yii2-user

Yii2 user authentication module
MIT License
253 stars 104 forks source link

Overriding #95

Closed vicmonmena closed 9 years ago

vicmonmena commented 9 years ago

Hi again!

I'd like to know which is the best way to override this module in case I'd like to:

Thx!

amnah commented 9 years ago

You'll want to extend the controller/model files.

Specifically:

  1. Write migration file
  2. Override User::rules() and User::attributeLabels()
  3. Override the DefaultController::actionLogin()
vicmonmena commented 9 years ago

Hi again!

Following your steps, I've found some doubts about how to do them:

  1. Write migration file depends on my new User model class? Do I have to implement it before launch migration?
  2. About the link extend the controller/model files: Do I have to create a new Module?

Thanks a lot!

amnah commented 9 years ago

1) Migrations don't rely on models. You can just use the {{%tableName}} syntax. See the migration file as an example

2) Create whatever you need to. If you need to override/add variables in the module class, then do so. Otherwise just stick with the controller/models