Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
systems:yii2:basic_user_login_from_database [2018/04/03 08:44] smayr |
systems:yii2:basic_user_login_from_database [2018/04/05 17:49] (current) smayr |
||
---|---|---|---|
Line 3: | Line 3: | ||
Perform these steps: | Perform these steps: | ||
* First create a '' | * First create a '' | ||
- | * In Gii, generate a User model. In this model, implement the '' | + | * In Gii, generate a User model. In this model, implement the '' |
- | * Now in Login form ('' | + | { |
+ | //... | ||
+ | }</ | ||
+ | * Now in '' | ||
+ | { | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | } | ||
+ | </ | ||
User Table: | User Table: | ||
Line 22: | Line 32: | ||
PRIMARY KEY (`id`), | PRIMARY KEY (`id`), | ||
UNIQUE KEY `username` (`username`), | UNIQUE KEY `username` (`username`), | ||
- | INDEX `FK_contact_external_customer_id` (`external_customer_id`), | + | ) |
- | | + | COLLATE=' |
- | | + | ENGINE=InnoDB |
+ | AUTO_INCREMENT=1; | ||
+ | </ | ||
+ | |||
+ | Or: | ||
+ | <code sql> | ||
+ | CREATE TABLE `user` ( | ||
+ | | ||
+ | `first_name` varchar(255) NOT NULL, | ||
+ | | ||
+ | `username` varchar(255) NOT NULL, | ||
+ | | ||
+ | `email` varchar(255) NOT NULL, | ||
+ | `password` varchar(255) NOT NULL, | ||
+ | `password_hash` varchar(255) NOT NULL, | ||
+ | `auth_key` varchar(255) NOT NULL, | ||
+ | `password_reset_token` varchar(250) NOT NULL, | ||
+ | `avatar` varchar(255) NOT NULL, | ||
+ | `role` enum(' | ||
) | ) | ||
COLLATE=' | COLLATE=' |