Compare commits
No commits in common. "adb5d3b94c3ad83ee51cb303f6baa9d217773cb6" and "18ea4071c7960b487d6feb1ca5004e21bc04979d" have entirely different histories.
adb5d3b94c
...
18ea4071c7
3 changed files with 26 additions and 79 deletions
|
@ -1,63 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Console\Commands;
|
|
||||||
|
|
||||||
use App\Models\User;
|
|
||||||
use Illuminate\Console\Command;
|
|
||||||
use Illuminate\Support\Facades\Validator;
|
|
||||||
|
|
||||||
class CreateUser extends Command
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The name and signature of the console command.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $signature = 'app:create-user
|
|
||||||
{name : The username of the user}
|
|
||||||
{email : The email of the user}
|
|
||||||
{password : Password in plain text (will be encrypted automatically)}
|
|
||||||
{--unverified : Keep the user unverified. Otherwise, email verified will be set at current time.}';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The console command description.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $description = 'Create a user to access the admin panel';
|
|
||||||
|
|
||||||
private array $rules = [
|
|
||||||
'name' => ['required', 'min:4', 'unique:users,name'],
|
|
||||||
'email' => ['required', 'email', 'unique:users,email'],
|
|
||||||
'password' => ['required', 'min:6'],
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Execute the console command.
|
|
||||||
*/
|
|
||||||
public function handle(): int
|
|
||||||
{
|
|
||||||
$validator = Validator::make([
|
|
||||||
'name' => $this->argument('name'),
|
|
||||||
'email' => $this->argument('email'),
|
|
||||||
'password' => $this->argument('password'),
|
|
||||||
], $this->rules);
|
|
||||||
|
|
||||||
try {
|
|
||||||
$userData = $validator->validated();
|
|
||||||
|
|
||||||
$userData['password'] = bcrypt($userData['password']);
|
|
||||||
$userData['email_verified_at'] = $this->option('unverified') ? NULL : now();
|
|
||||||
|
|
||||||
User::factory()->create($userData);
|
|
||||||
|
|
||||||
$this->info('User created.');
|
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
$this->error("ERROR: {$e->getMessage()} [Code: {$e->getCode()}]");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -4,7 +4,7 @@ packaging_format = 2
|
||||||
|
|
||||||
id = "my_idlers"
|
id = "my_idlers"
|
||||||
name = "My Idlers"
|
name = "My Idlers"
|
||||||
description.en = "A self-hosted web app for displaying, organizing and storing information about your servers (VPS/Dedi), shared & reseller hosting, seedboxes, domains, DNS and misc services. Are you the person in your family, group of friends or at work who keeps an eye on everyones Yunohosts, then this is the app to help you."
|
description.en = "A self-hosted web app for displaying, organizing and storing information about your servers (VPS/Dedi), shared & reseller hosting, seedboxes, domains, DNS and misc services."
|
||||||
description.fr = "Une application Web auto-hébergée pour afficher, organiser et stocker des informations sur vos serveurs (VPS/Dedi), votre hébergement partagé et revendeur, vos seedboxes, vos domaines, vos DNS et divers services."
|
description.fr = "Une application Web auto-hébergée pour afficher, organiser et stocker des informations sur vos serveurs (VPS/Dedi), votre hébergement partagé et revendeur, vos seedboxes, vos domaines, vos DNS et divers services."
|
||||||
|
|
||||||
version = "3.0~ynh1"
|
version = "3.0~ynh1"
|
||||||
|
@ -46,16 +46,12 @@ ram.runtime = "100M"
|
||||||
default = "all_users"
|
default = "all_users"
|
||||||
|
|
||||||
# for now no credentials configured, make it install first
|
# for now no credentials configured, make it install first
|
||||||
[install.name]
|
# [install.admin]
|
||||||
help.en = "The name of the user"
|
# type = "user"
|
||||||
type = "text"
|
# [install.password]
|
||||||
[install.email]
|
# help.en = "Use the help field to add an information for the admin about this question."
|
||||||
help.en = "The email address used for logging in to the application"
|
# help.fr = "Utilisez le champ aide pour ajouter une information à l'intention de l'administrateur à propos de cette question."
|
||||||
type = "email"
|
# type = "password"
|
||||||
[install.password]
|
|
||||||
help.en = "Use the help field to add an information for the admin about this question."
|
|
||||||
help.fr = "Utilisez le champ aide pour ajouter une information à l'intention de l'administrateur à propos de cette question."
|
|
||||||
type = "password"
|
|
||||||
|
|
||||||
[resources]
|
[resources]
|
||||||
# See the packaging documentation for the full set
|
# See the packaging documentation for the full set
|
||||||
|
|
|
@ -44,9 +44,6 @@ ynh_config_add --template=.env --destination="$install_dir/.env"
|
||||||
chmod 640 "$install_dir/.env"
|
chmod 640 "$install_dir/.env"
|
||||||
chown "$app:www-data" "$install_dir/.env"
|
chown "$app:www-data" "$install_dir/.env"
|
||||||
|
|
||||||
# Inject CreateUser.php into app/Console/Commands/ to extend the upstream version with this functionality
|
|
||||||
# Using this, we can create the user with the credentials provided
|
|
||||||
ynh_config_add --template=CreateUser.php --destination="$install_dir/app/Console/Commands/CreateUser.php"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SYSTEM CONFIGURATION
|
# SYSTEM CONFIGURATION
|
||||||
|
@ -100,7 +97,7 @@ pushd "$install_dir"
|
||||||
"php$php_version" artisan migrate:fresh --seed -n --force
|
"php$php_version" artisan migrate:fresh --seed -n --force
|
||||||
"php$php_version" artisan config:clear -n
|
"php$php_version" artisan config:clear -n
|
||||||
"php$php_version" artisan config:cache -n
|
"php$php_version" artisan config:cache -n
|
||||||
"php$php_version" artisan app:create-user "$name" "$email" "$password"
|
#"php$php_version" artisan lychee:create_user "$admin" "$password"
|
||||||
|
|
||||||
popd
|
popd
|
||||||
|
|
||||||
|
@ -125,7 +122,24 @@ chmod -R 2775 "$install_dir/storage" "$install_dir/app" "$install_dir/public" "$
|
||||||
|
|
||||||
# Installation with curl
|
# Installation with curl
|
||||||
ynh_script_progression "Finalizing installation..."
|
ynh_script_progression "Finalizing installation..."
|
||||||
#ynh_local_curl "/INSTALL_PATH" "key1=$name" "key2=$email" "key3=$password" "key4=$password"
|
#ynh_local_curl "/INSTALL_PATH" "key1=value1" "key2=value2" "key3=value3"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# START SYSTEMD SERVICE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression "Starting $app's systemd service..."
|
||||||
|
|
||||||
|
### `ynh_systemctl` is used to start a systemd service for an app.
|
||||||
|
### Only needed if you have configure a systemd service
|
||||||
|
### If you're not using these lines:
|
||||||
|
### - Remove the section "STOP SYSTEMD SERVICE" and "START SYSTEMD SERVICE" in the backup script
|
||||||
|
### - As well as the section "START SYSTEMD SERVICE" in the restore script
|
||||||
|
### - As well as the section"STOP SYSTEMD SERVICE" and "START SYSTEMD SERVICE" in the upgrade script
|
||||||
|
### - And the section "STOP SYSTEMD SERVICE" and "START SYSTEMD SERVICE" in the change_url script
|
||||||
|
|
||||||
|
# Start a systemd service
|
||||||
|
ynh_systemctl --service="nginx" --action="reload"
|
||||||
|
ynh_systemctl --service="php$php_version-fpm" --action="reload"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
Loading…
Add table
Reference in a new issue