mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-17 20:52:14 +01:00
Compare commits
1 Commits
ccf2b1246d
...
feature/fi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bf2798c0f4 |
@@ -23,6 +23,10 @@ class InvitationService
|
|||||||
*/
|
*/
|
||||||
public function inviteUser(Organization $organization, string $email, Role $role, User $inviter): OrganizationInvitation
|
public function inviteUser(Organization $organization, string $email, Role $role, User $inviter): OrganizationInvitation
|
||||||
{
|
{
|
||||||
|
// Normalize the email so it matches how user emails are stored (see UserService::createUser),
|
||||||
|
// otherwise a mixed-case invite silently fails to link on registration.
|
||||||
|
$email = strtolower($email);
|
||||||
|
|
||||||
if (app(MemberService::class)->isEmailAlreadyMember($organization, $email)) {
|
if (app(MemberService::class)->isEmailAlreadyMember($organization, $email)) {
|
||||||
throw new UserIsAlreadyMemberOfOrganizationApiException;
|
throw new UserIsAlreadyMemberOfOrganizationApiException;
|
||||||
}
|
}
|
||||||
@@ -55,7 +59,7 @@ class InvitationService
|
|||||||
$organizations = new Collection;
|
$organizations = new Collection;
|
||||||
|
|
||||||
$invitations = OrganizationInvitation::query()
|
$invitations = OrganizationInvitation::query()
|
||||||
->where('email', $user->email)
|
->whereRaw('lower(email) = ?', [strtolower($user->email)])
|
||||||
->whereNotNull('accepted_at')
|
->whereNotNull('accepted_at')
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
|
|||||||
4395
package-lock.json
generated
4395
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
26
package.json
26
package.json
@@ -26,13 +26,13 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/eslintrc": "^3.3.5",
|
"@eslint/eslintrc": "^3.3.5",
|
||||||
"@eslint/js": "^10.0.1",
|
"@eslint/js": "^9.39.4",
|
||||||
"@inertiajs/vue3": "^3.6.1",
|
"@inertiajs/vue3": "^2.3.23",
|
||||||
"@playwright/test": "^1.60.0",
|
"@playwright/test": "^1.60.0",
|
||||||
"@tailwindcss/forms": "^0.5.11",
|
"@tailwindcss/forms": "^0.5.11",
|
||||||
"@tailwindcss/typography": "^0.5.19",
|
"@tailwindcss/typography": "^0.5.19",
|
||||||
"@types/chroma-js": "^3.1.2",
|
"@types/chroma-js": "^3.1.2",
|
||||||
"@types/node": "^26.1.1",
|
"@types/node": "^22.19.19",
|
||||||
"@vitejs/plugin-vue": "^6.0.6",
|
"@vitejs/plugin-vue": "^6.0.6",
|
||||||
"@vue/test-utils": "^2.4.6",
|
"@vue/test-utils": "^2.4.6",
|
||||||
"@vue/tsconfig": "^0.8.1",
|
"@vue/tsconfig": "^0.8.1",
|
||||||
@@ -40,14 +40,14 @@
|
|||||||
"axios": "^1.16.0",
|
"axios": "^1.16.0",
|
||||||
"eslint-plugin-unused-imports": "^4.4.1",
|
"eslint-plugin-unused-imports": "^4.4.1",
|
||||||
"happy-dom": "^20.8.9",
|
"happy-dom": "^20.8.9",
|
||||||
"laravel-vite-plugin": "^3.1.3",
|
"laravel-vite-plugin": "^2.1.0",
|
||||||
"openapi-zod-client": "^1.18.3",
|
"openapi-zod-client": "^1.18.3",
|
||||||
"postcss": "^8.5.14",
|
"postcss": "^8.5.14",
|
||||||
"postcss-import": "^16.1.1",
|
"postcss-import": "^15.1.0",
|
||||||
"postcss-nesting": "^14.0.0",
|
"postcss-nesting": "^12.1.5",
|
||||||
"tailwindcss": "^4.3.3",
|
"tailwindcss": "^3.4.19",
|
||||||
"typescript": "^7.0.2",
|
"typescript": "^5.9.3",
|
||||||
"vite": "^8.1.5",
|
"vite": "^7.3.3",
|
||||||
"vite-plugin-checker": "^0.12.0",
|
"vite-plugin-checker": "^0.12.0",
|
||||||
"vitest": "^4.1.4",
|
"vitest": "^4.1.4",
|
||||||
"vue": "^3.5.34",
|
"vue": "^3.5.34",
|
||||||
@@ -55,14 +55,14 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@floating-ui/core": "^1.7.5",
|
"@floating-ui/core": "^1.7.5",
|
||||||
"@floating-ui/vue": "^2.0.1",
|
"@floating-ui/vue": "^1.1.11",
|
||||||
"@heroicons/vue": "^2.2.0",
|
"@heroicons/vue": "^2.2.0",
|
||||||
"@lucide/vue": "^1.14.0",
|
"@lucide/vue": "^1.14.0",
|
||||||
"@rushstack/eslint-patch": "^1.16.1",
|
"@rushstack/eslint-patch": "^1.16.1",
|
||||||
"@tailwindcss/container-queries": "^0.1.1",
|
"@tailwindcss/container-queries": "^0.1.1",
|
||||||
"@tanstack/vue-form": "^1.32.0",
|
"@tanstack/vue-form": "^1.32.0",
|
||||||
"@tanstack/vue-query": "^5.100.10",
|
"@tanstack/vue-query": "^5.100.10",
|
||||||
"@tanstack/vue-query-devtools": "^6.1.36",
|
"@tanstack/vue-query-devtools": "^5.91.0",
|
||||||
"@tanstack/vue-table": "^8.21.3",
|
"@tanstack/vue-table": "^8.21.3",
|
||||||
"@tanstack/vue-virtual": "^3.13.24",
|
"@tanstack/vue-virtual": "^3.13.24",
|
||||||
"@vue/eslint-config-prettier": "^10.2.0",
|
"@vue/eslint-config-prettier": "^10.2.0",
|
||||||
@@ -77,10 +77,10 @@
|
|||||||
"echarts": "^6.0.0",
|
"echarts": "^6.0.0",
|
||||||
"focus-trap": "^8.2.0",
|
"focus-trap": "^8.2.0",
|
||||||
"parse-duration": "^2.1.6",
|
"parse-duration": "^2.1.6",
|
||||||
"pinia": "^4.0.2",
|
"pinia": "^3.0.4",
|
||||||
"radix-vue": "^1.9.17",
|
"radix-vue": "^1.9.17",
|
||||||
"reka-ui": "^2.9.7",
|
"reka-ui": "^2.9.7",
|
||||||
"tailwind-merge": "^3.6.0",
|
"tailwind-merge": "^2.6.1",
|
||||||
"tailwindcss-animate": "^1.0.7",
|
"tailwindcss-animate": "^1.0.7",
|
||||||
"vue-draggable-plus": "^0.6.1",
|
"vue-draggable-plus": "^0.6.1",
|
||||||
"vue-echarts": "^8.0.1",
|
"vue-echarts": "^8.0.1",
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
"author": "solidtime",
|
"author": "solidtime",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"vite-plugin-dts": "^5.0.3"
|
"vite-plugin-dts": "^4.5.4"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@zodios/core": "^10.9.6",
|
"@zodios/core": "^10.9.6",
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/chroma-js": "^3.1.2",
|
"@types/chroma-js": "^3.1.2",
|
||||||
"@zodios/core": "^10.9.6",
|
"@zodios/core": "^10.9.6",
|
||||||
"vite-plugin-dts": "^5.0.3",
|
"vite-plugin-dts": "^4.5.4",
|
||||||
"zod": "^3.25.76"
|
"zod": "^3.25.76"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
|
|||||||
@@ -380,6 +380,40 @@ class RegistrationTest extends TestCaseWithDatabase
|
|||||||
$this->assertSame($user->organization->id, $organizations->first()->id);
|
$this->assertSame($user->organization->id, $organizations->first()->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_registration_joins_invited_organization_even_if_invitation_email_casing_differs(): void
|
||||||
|
{
|
||||||
|
// Arrange: invitation stored with a different casing than the registration email
|
||||||
|
$user = $this->createUserWithPermission();
|
||||||
|
OrganizationInvitation::factory()
|
||||||
|
->forOrganization($user->organization)
|
||||||
|
->role(Role::Employee)
|
||||||
|
->accepted()
|
||||||
|
->create([
|
||||||
|
'email' => 'Invited.User@example.com',
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
$response = $this->post('/register', [
|
||||||
|
'name' => 'Invited User',
|
||||||
|
'email' => 'invited.user@example.com',
|
||||||
|
'password' => 'password',
|
||||||
|
'password_confirmation' => 'password',
|
||||||
|
'terms' => true,
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Assert: joined the inviting organization, no extra personal organization, invitation consumed
|
||||||
|
$this->assertAuthenticated();
|
||||||
|
$response->assertRedirect(RouteServiceProvider::HOME);
|
||||||
|
$newUser = User::where('email', 'invited.user@example.com')->first();
|
||||||
|
$this->assertNotNull($newUser);
|
||||||
|
$this->assertDatabaseMissing(OrganizationInvitation::class, [
|
||||||
|
'email' => 'Invited.User@example.com',
|
||||||
|
]);
|
||||||
|
$organizations = $newUser->organizations;
|
||||||
|
$this->assertCount(1, $organizations);
|
||||||
|
$this->assertSame($user->organization->id, $organizations->first()->id);
|
||||||
|
}
|
||||||
|
|
||||||
public function test_registration_logs_and_skips_accepted_invitation_with_invalid_role(): void
|
public function test_registration_logs_and_skips_accepted_invitation_with_invalid_role(): void
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
|
|||||||
Reference in New Issue
Block a user