@webship.co/workspace-laravel 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webship.co/workspace-laravel",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Laravel for Webship Workspace: the builder (`cmd-laravel-project.sh`, the official installer and an official starter kit) and the Artisan tool in every sites folder, the default accounts, the Laravel step pack wired into the testing setup, and its AI items in their folders: two agents, a skill, a command and two prompts.",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -55,8 +55,8 @@ function laravel_enter_project() {
55
55
  cd "${project_path}" || return 1 ;
56
56
  }
57
57
 
58
- # Write accounts through the app itself, so a password is hashed the way the app hashes it and the
59
- # model is the app's own (config auth.providers.users.model). Reads lines of
58
+ # Write accounts through the app itself, so a password is hashed with the app's own hasher (whether
59
+ # or not its User model casts it) and the model is the app's own (config auth.providers.users.model). Reads lines of
60
60
  # "name|email|password|verified" on standard input; "delete" as the first argument removes the
61
61
  # accounts of those addresses instead, and "list" lists every account of the app. Runs in the
62
62
  # project folder, in the container.
@@ -85,7 +85,12 @@ foreach (file($file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) as $line) {
85
85
  }
86
86
  $user = $model::query()->firstOrNew(['email' => $email]);
87
87
  $user->name = $name;
88
- $user->password = $password;
88
+ // Hashed here: not every app's User model casts the password as hashed, and one that does never
89
+ // hashes a hash twice. A password the account already has keeps its hash, so writing the accounts
90
+ // again does not end their sessions.
91
+ if (! $user->password || ! Illuminate\Support\Facades\Hash::check($password, $user->password)) {
92
+ $user->password = Illuminate\Support\Facades\Hash::make($password);
93
+ }
89
94
  $user->email_verified_at = $verified === 'verified' ? now() : null;
90
95
  $user->save();
91
96
  printf(" %s <%s>%s\n", $user->name, $user->email, $user->email_verified_at ? '' : ' (address not verified)');