Add structured specification and show set-password links to admins
The customer answered the open questions in määrittely.txt. Collect the answers into docs/maarittely.md: roles and permission table, money visibility, customer job fields and enum keys, Kanban, tasks, time entries, expenses, pricing, Fennoa billing export, data model, revised phases with phase 1 in detail, and remaining open questions. CLAUDE.md now points to it. Apply the answers that change the Users module: - Passwords need 12+ characters with mixed case, a number and a symbol, with a Finnish message for each rule. - When an admin creates a user or asks for a new link, the set-password link is emailed and also shown to the admin to copy, even if the email fails. The link lives only in the page state. users:create-admin prints it too. Self-service "forgot password" stays as it was. - The copy field uses x-input + x-button with a status message, because x-clipboard has an unlabelled input and a changing button name. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -33,11 +33,12 @@ beforeEach(function () {
|
||||
$this->employeeId = $this->users->save(UserAccount::register(new PersonName('Eero Työntekijä'), new EmailAddress('[email protected]'), Role::Employee))->id();
|
||||
});
|
||||
|
||||
it('creates a user and sends a link for setting the password', function () {
|
||||
$userId = $this->createUser->execute(new UserAccountData('Maija Meikäläinen', '[email protected]', Role::Employee))->userId;
|
||||
it('creates a user and returns the emailed link for setting the password', function () {
|
||||
$created = $this->createUser->execute(new UserAccountData('Maija Meikäläinen', '[email protected]', Role::Employee));
|
||||
|
||||
expect($this->users->findById($userId)?->email()->value)->toBe('[email protected]')
|
||||
->and($this->passwordLinks->sentTo)->toBe(['[email protected]']);
|
||||
expect($this->users->findById($created->userId)?->email()->value)->toBe('[email protected]')
|
||||
->and($this->passwordLinks->sentTo)->toBe(['[email protected]'])
|
||||
->and($created->setupLink->url)->toContain('maija%40example.test');
|
||||
});
|
||||
|
||||
it('creates an intern with an end date and a supervisor', function () {
|
||||
@@ -103,9 +104,10 @@ it('fails to update an unknown user', function () {
|
||||
})->throws(UserAccountNotFound::class);
|
||||
|
||||
it('sends a password link to a stored user', function () {
|
||||
(new SendPasswordSetupLink($this->users, $this->passwordLinks))->execute($this->employeeId);
|
||||
$link = (new SendPasswordSetupLink($this->users, $this->passwordLinks))->execute($this->employeeId);
|
||||
|
||||
expect($this->passwordLinks->sentTo)->toBe(['[email protected]']);
|
||||
expect($this->passwordLinks->sentTo)->toBe(['[email protected]'])
|
||||
->and($link->url)->toContain('eero%40example.test');
|
||||
});
|
||||
|
||||
it('checks whether a user may log in today', function () {
|
||||
|
||||
Reference in New Issue
Block a user