I do import of users from a csv file to the database. In csv file I have some kinda username and password string. So how do I create a new user manually?
As I understand I need to getPasswordHash
and generateAuthKey
(last one generates random string). But probably I loose something important since when I try to log in I get an error that Username or Password is incorrect. Did anyone ever experienced such situation? Thanks in advance.
相关问题
- NOT DISTINCT query in mySQL
- Flush single app django 1.9
- keeping one connection to DB or opening closing pe
- Mysql-installer showing error : Memoy could not be
- Android Room Fetch data with dynamic table name
相关文章
- Can you run console jobs from yii2-basic?
- How to do a bulk database insert in Yii2?
- Connection pooling vs persist connection mysqli
- How to send mail to multiple recipients in Yii2 ma
- Yii2 - check if the user is logged in view
- Speed up sqlFetch()
- How Do I Seed My Database in the setupBeforeClass
- I set a MySQL column to “NOT NULL” but still I can
This should be the minimum required in your case.
$username
and$password
are raw values taken from the CSV. Remember that there will be validation applied.I think you forgot to set an active status of new User. You should check it in Login method of User model in your app, or in actionLogin of SiteController. For example, in my app the login method is:
If you show your code we can help you faster)
So if you are importing a list of users from a csv file, you will probably process this in a loop, try: