Database authentication for users

Hi Guys,

I may sound like a broken record here, and also a complete novice, however I’m really confused about the process of turning the basic application template into one which will authenticate users against a MySQL database.

I’ve gone through the advanced app code, I’ve read anything I can find in the docs or any other articles/blog posts etc but everything I try appears to ignore my database

I’ve created a User model which extends ActiveRecord, and when I pull through my password_hash, and use the security functions to validate the password, it validates fine

I just can’t seem to get it all set up in such a way that it actually works properly. If anyone could shed some light on this, or even just outline to process that Yii2 takes from clicking submit, that may help. I think I understand it but potentially the new classes I’ve written aren’t doing what they should be


You could be doing anything…

So I don’t think it is possible to help you without a lot more detailed information about what you are doing and what you have tried.

If you didn’t become wiser from studying the advanced Yii2 app code, then could you perhaps fill in some details? :)

Remember that the definitive guide to Yii2 has a section about authenticating users.