create-nevela 0.7.0 → 0.7.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": "create-nevela",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Create a new Nevela app: a Laravel API and a Next.js dashboard from one resource description.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -57,10 +57,8 @@ final class SampleUsers
57
57
  if (Account::findByEmail($email)) {
58
58
  continue;
59
59
  }
60
+ // Their addresses are made up, and nobody has proved one: they are not "verified".
60
61
  $attributes = ['name' => $name, 'email' => $email, 'password' => $hash];
61
- if (Schema::hasColumn($table, 'email_verified_at')) {
62
- $attributes['email_verified_at'] = now();
63
- }
64
62
  if (Schema::hasColumn($table, 'active')) {
65
63
  $attributes['active'] = $active;
66
64
  }
@@ -18,6 +18,7 @@ final class UserCommand extends Command
18
18
  {--email= : The address they sign in with}
19
19
  {--password= : Their password. Leave out to be asked for it without it showing}
20
20
  {--role= : Their role: ADMIN, EDITOR, USER or one you have made. The first account is an ADMIN}
21
+ {--verified : Mark the email as verified. Only for an address you know is theirs}
21
22
  {--sample : Create the ten sample users instead: two editors and eight users}';
22
23
 
23
24
  protected $description = 'Create a user who can sign in to the dashboard';
@@ -68,7 +69,10 @@ final class UserCommand extends Command
68
69
 
69
70
  // forceFill: this is the operator creating an account, not a form to guard.
70
71
  $attributes = ['name' => $input['name'], 'email' => $input['email'], 'password' => Hash::make($input['password'])];
71
- if (Schema::hasColumn($table, 'email_verified_at')) {
72
+ // "Verified" means the owner has proved the address is theirs, by a link or a code
73
+ // sent to it. Making an account here proves nothing of the kind, so it starts
74
+ // unverified unless whoever runs this says they know the address is right.
75
+ if ($this->option('verified') && Schema::hasColumn($table, 'email_verified_at')) {
72
76
  $attributes['email_verified_at'] = now();
73
77
  }
74
78
  $user = (new $model)->forceFill($attributes);
@@ -117,10 +117,8 @@ final class UsersController
117
117
  if (Schema::hasColumn($user->getTable(), 'active')) {
118
118
  $attributes['active'] = (bool) ($input['active'] ?? true);
119
119
  }
120
- if (Schema::hasColumn($user->getTable(), 'email_verified_at')) {
121
- // Someone allowed to create users vouches for the address.
122
- $attributes['email_verified_at'] = now();
123
- }
120
+ // The address is as typed by whoever is adding them. It becomes "verified" when its
121
+ // owner proves it: from their Account page, or by signing in with an emailed link or code.
124
122
  $user->forceFill($attributes)->save();
125
123
  Access::assign($user, $roles->pluck('id')->all());
126
124
 
@@ -21,7 +21,7 @@ use Nevela\Laravel\Support\Naming;
21
21
  final class Nevela
22
22
  {
23
23
  /** Written by `pnpm release`; the same number as the repository's git tag. */
24
- public const VERSION = '0.7.0';
24
+ public const VERSION = '0.7.1';
25
25
 
26
26
  /** @var array<string, Descriptor> */
27
27
  private static array $descriptors = [];
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nevela-web",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "scripts": {