-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Added script for creating Magento admin user and customer #1040
Added script for creating Magento admin user and customer #1040
Conversation
PR Summary
|
By the way, I can modify this script so that the user can create an admin user or new customer account. |
@YevhenZvieriev thanks! I think we should prompt the user for input though, and fall back to defaults if they just "enter" through the script though, no? I like your idea of extending this script to also apply to customer accounts. Perhaps we can rename this to I think this makes sense... let me know if it does or not. |
Hi, @markshust Good idea! I`ll do it in my next commit. |
Updated 25.02.2024:Admin User Creation: The script includes a function to create an admin user account, allowing customization of username, email, first name, last name, and password. Customer Account Creation: Another function enables the creation of customer accounts, with the option to either use default values or input custom details for email, password, first name, last name, and website. Dependency-Check: It checks for the existence of n98-magerun2.phar and downloads it if not found, ensuring the necessary tool for Magento CLI operations is available, n98 is used for creating customer accounts. User Interaction: The script prompts the user to choose between creating an admin or a customer account and provides prompts for further customization if required. How added features work: Screencast.from.2024-02-25.01-37-40.webm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates! But I'd like this script simplified, as there is too much going on in the code and it can be made more intuitive with the suggested updates.
Hi, @markshust I took into account all your amendments and simplified the script. |
Standardized bash input prompt for the creation of either account and removed unneeded functions
Fixed shellcheck to prevent globbing and splitting.
@YevhenZvieriev I feel as though the script was still way too unnecessarily complex. I think you removed something that shouldn't have been removed (which is the standardization of inputs between the two accounts). It'd be nice for both of these scripts to share the same prompts for email, password, etc. rather than the disconnect between the Magento and magerun scripts. Also, there were unneeded references to n98-magerun2. Again, all of the functionality to download, install, check n98-magerun2 is in the https://github.com/markshust/docker-magento/blob/master/compose/bin/n98-magerun2 file, so we don't need it anywhere else. There were also same malformed indentations which I removed. All code in this project strives for elegance + simplicity -- if it doesn't match either of those two aspects, it will always be denied, hung up for a long while, or closed out and not merged. I updated this PR, and appreciate your initial one! But as a case-study for future PR's, I'd compare:
This is 85 lines vs 21 lines. This is less code to maintain, it's easier to read the file and understand what is going on, and it's very elegant -- it doesn't do anything that it doesn't need to do. But, it does just enough to add some extra functionality that goes above and beyond what someone would expect. |
Every helper script created also needs a corresponding addition to the README, describing the script, and also added to the Makefile! (something that I routinely forget 😅) 8cad6b6 |
Added a script
bin/create-user
to automate the creation of a Magento admin user and customer. The script utilizes thebin/magento admin:user:create
command with predefined values for the admin user, and n98 for creating a customer.