++ cambio password obbligato: al primo accesso del sorvegliante dice "Password temporanea", non "Ripristino da backup"
users.password_temporanea distingue la password provvisoria data dall'amministratore (creazione del gruppo, "Nuova password temporanea") dal ripristino da backup. Migrazione 000040; si spegne a password cambiata, il ripristino e l'import XML la spengono per tutti. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -219,6 +219,33 @@ class GruppiServizioTest extends TestCase
|
||||
$this->get(route('dashboard'))->assertOk()->assertDontSee('Il mio gruppo')->assertSee('Gruppi di servizio');
|
||||
}
|
||||
|
||||
public function test_al_primo_accesso_il_sorvegliante_cambia_la_password_temporanea(): void
|
||||
{
|
||||
$rossi = $this->proclamatore('Rossi', 'Mario');
|
||||
[$gruppo] = app(GruppiServizio::class)->crea('Zisa', $rossi);
|
||||
$s = User::where('email', 'mrossi@termanager.it')->sole();
|
||||
$this->assertTrue($s->password_temporanea);
|
||||
$this->flushSession();
|
||||
$this->actingAs($s);
|
||||
|
||||
$this->get(route('mio-gruppo'))->assertRedirect(route('password.change'));
|
||||
$this->get(route('password.change'))->assertOk()
|
||||
->assertSee('Password temporanea')
|
||||
->assertDontSee('Ripristino da backup');
|
||||
|
||||
$this->post(route('password.change.store'), ['password' => 'una-password-mia-1', 'password_confirmation' => 'una-password-mia-1'])
|
||||
->assertRedirect(route('dashboard'));
|
||||
$this->assertFalse($s->fresh()->password_temporanea);
|
||||
$this->assertFalse($s->fresh()->password_change_required);
|
||||
$this->get(route('mio-gruppo'))->assertOk();
|
||||
|
||||
// "Nuova password temporanea" dalla pagina del gruppo: di nuovo temporanea.
|
||||
$this->flushSession();
|
||||
Livewire::actingAs($this->admin)->test(GruppoShow::class, ['gruppo' => $gruppo])->call('nuovaPassword');
|
||||
$this->assertTrue($s->fresh()->password_temporanea);
|
||||
$this->assertTrue($s->fresh()->password_change_required);
|
||||
}
|
||||
|
||||
public function test_il_sorvegliante_entra_con_l_email_fittizia_senza_conferma_e_va_al_suo_gruppo(): void
|
||||
{
|
||||
$this->gruppo();
|
||||
|
||||
Reference in New Issue
Block a user