Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI command to create_user fails - password_hash is required #180

Closed
JamesShaver opened this issue Apr 6, 2020 · 6 comments
Closed

CLI command to create_user fails - password_hash is required #180

JamesShaver opened this issue Apr 6, 2020 · 6 comments

Comments

@JamesShaver
Copy link
Contributor

It looks like the CLI method to create a user doesn't work, as the password_hash field is required. Here's a copy/paste of what I'm seeing:

[centos@hostCodeIgniter4]$ php spark auth:create_user


CodeIgniter CLI Tool - Version 4.0.2 - Server-Time: 2020-04-06 17:21:46pm

Username: admin
Email: myemail@myhost.com
The password_hash field is required.

@JamesShaver
Copy link
Contributor Author

My apologies if I'm doing this wrong (new to github), but I made a pull request to update the CreateUser file. Let me know any issues...
#181

@michalsn
Copy link
Contributor

michalsn commented Apr 7, 2020

I couldn't recreate this in the latest dev branch.

php spark auth:create_user


CodeIgniter CLI Tool - Version 4.0.2 - Server-Time: 2020-04-07 09:15:47am

Username: test
Email: test@test.com
New user created: test, #2

@JamesShaver
Copy link
Contributor Author

Can you tell me what's happening with the password field in your scenario?
Since the field is required, how is the password being generated?
password_hash varchar(255) NOT NULL,

@JamesShaver
Copy link
Contributor Author

I just ran through a fresh install, following these steps below... same issue. I'm not discounting that this may be my fault in some way, but I don't see it yet. Please let me know if I'm missing something.

d:\xampp\htdocs>composer create-project codeigniter4/appstarter CI4 -s rc
d:\xampp\htdocs>cd CI4
d:\xampp\htdocs\CI4>composer config minimum-stability dev
d:\xampp\htdocs\CI4>composer require myth/auth
CI4\app\Config\App.php - public $baseURL = 'http://localhost/CI4/public/';
CI4\app\Config\Database.php - updated
d:\xampp\htdocs\CI4>php spark migrate -all
CodeIgniter CLI Tool - Version 4.0.2 - Server-Time: 2020-04-07 09:01:52am

Running all new migrations...
Running: (Tests\Support) 20160428212500_Tests\Support\Database\Migrations\Migration_Create_test_tables
Running: (Myth\Auth) 2017-11-20-223112_Myth\Auth\Database\Migrations\CreateAuthTables
Running: (Tests\Support) 2020-02-22-222222_Tests\Support\Database\Migrations\ExampleMigration
Done

d:\xampp\htdocs\CI4>php spark auth:publish

CodeIgniter CLI Tool - Version 4.0.2 - Server-Time: 2020-04-07 09:03:31am

Publish Migration? [y, n]: y
created: Database/Migrations/2017-11-20-223112_create_auth_tables.php
Remember to run spark migrate -all to migrate the database.
Publish Models? [y, n]: y
created: Models/LoginModel.php
created: Models/UserModel.php
Publish Entities? [y, n]: y
created: Entities/User.php
Publish Controller? [y, n]: y
created: Controllers/AuthController.php
Publish Views? [y, n]: y
created: Views/Auth/emails\activation.php
created: Views/Auth/emails\forgot.php
created: Views/Auth/forgot.php
created: Views/Auth/layout.php
created: Views/Auth/login.php
created: Views/Auth/register.php
created: Views/Auth/reset.php
created: Views/Auth/_footer.php
created: Views/Auth/_header.php
created: Views/Auth/_message_block.php
created: Views/Auth/_navbar.php
Publish Config file? [y, n]: y
created: Config/Auth.php
Publish Language file? [y, n]: y
created: Language/en/Auth.php

d:\xampp\htdocs\CI4>php spark auth:create_user

CodeIgniter CLI Tool - Version 4.0.2 - Server-Time: 2020-04-07 09:03:53am

Username: admin
Email: myemail@myhost.com
The password_hash field is required.

@michalsn
Copy link
Contributor

michalsn commented Apr 7, 2020

As I said, please use the latest dev version. In your composer.json file:

"myth/auth": "dev-develop"

I also strongly advise you not to use:

"minimum-stability": "dev"

...unless you're just checking out the project.

@JamesShaver
Copy link
Contributor Author

Well it's interesting to me that this worked... I'm new to composer/github, and I had assumed this would install the latest:
composer require myth/auth
I initially wasn't able to install auth without setting the minimum stability. I updated composer.json as you mentioned, removed the minimum stability, and used composer update to install.

Thanks for your help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants