diff --git a/resources/views/user/dashboard.blade.php b/resources/views/user/dashboard.blade.php index 9a91a6f..f289308 100644 --- a/resources/views/user/dashboard.blade.php +++ b/resources/views/user/dashboard.blade.php @@ -49,7 +49,7 @@ -
+
@@ -94,7 +94,7 @@
-
+
diff --git a/tests/Feature/PasswordMd5Test.php b/tests/Feature/PasswordMd5Test.php new file mode 100644 index 0000000..0a21f06 --- /dev/null +++ b/tests/Feature/PasswordMd5Test.php @@ -0,0 +1,67 @@ +userService = $this->app->make(UserServiceInterface::class); + $this->adminService = $this->app->make(AdminServiceInterface::class); + } + + public function test_user_service_update_password_stores_as_md5(): void + { + $user = User::create([ + 'msnv' => 4001, + 'name' => 'Test User', + 'mail' => 'test@example.com', + 'pass' => md5('old_password'), + 'departments' => 1, + 'role' => User::ROLE_MEMBER, + 'status' => User::STATUS_ACTIVE, + 'card' => 10, + 'flag_send' => User::FLAG_SEND_ENABLED, + 'first_login' => User::FIRST_LOGIN_TRUE, + ]); + + $this->userService->updatePassword($user, 'new_secret_password'); + + $user->refresh(); + + $this->assertEquals(md5('new_secret_password'), $user->pass); + $this->assertEquals(User::FIRST_LOGIN_FALSE, $user->first_login); + } + + public function test_admin_service_create_user_stores_password_as_md5(): void + { + $data = [ + 'msnv' => 4002, + 'name' => 'Created User', + 'mail' => 'created@example.com', + 'departments' => 2, + 'password' => 'admin_created_pass', + 'role' => User::ROLE_MEMBER, + ]; + + $this->adminService->createUser($data); + + $user = User::where('msnv', 4002)->first(); + + $this->assertNotNull($user); + $this->assertEquals(md5('admin_created_pass'), $user->pass); + $this->assertEquals(User::FIRST_LOGIN_TRUE, $user->first_login); + } +} diff --git a/tests/Feature/UserDashboardLayoutTest.php b/tests/Feature/UserDashboardLayoutTest.php new file mode 100644 index 0000000..3aeedb8 --- /dev/null +++ b/tests/Feature/UserDashboardLayoutTest.php @@ -0,0 +1,31 @@ +create([ + 'email' => 'admin@runsystem.net', + 'name' => 'System Admin', + ]); + + $this->actingAs($user); + + $response = $this->get('/my-page'); + + $response->assertOk(); + $response->assertSee('Thanks gần đây', false); + $response->assertSee('Bảng xếp hạng', false); + $response->assertSee('xl:flex-row', false); + $response->assertSee('xl:w-[380px]', false); + $response->assertSee('xl:flex-shrink-0', false); + $response->assertSee('flex-1 min-w-0', false); + } +}