Skip to content

Commit 572b0a2

Browse files
Improve approval page with cantonal contact information
- Display cantonal office email on pending approval page based on user groups - Store user groups in session for approval page acces
1 parent 05b536a commit 572b0a2

5 files changed

Lines changed: 14 additions & 5 deletions

File tree

app/Http/Controllers/UserController.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,13 @@ public function pending(Request $request)
227227
return redirect()->route('home');
228228
}
229229

230-
return view('auth.approval');
230+
// Get groups from session (stored during registration)
231+
$groups = $request->session()->get('keycloak_groups', []);
232+
233+
// Get cantonal office email for contact
234+
$cantonEmail = \App\Services\CantonEmailService::getCantonEmail($groups);
235+
236+
return view('auth.approval', ['cantonEmail' => $cantonEmail]);
231237
}
232238

233239
/**
@@ -265,6 +271,9 @@ public function register(Request $request, UserFederationService $federationServ
265271
return redirect()->route('registration-error');
266272
}
267273

274+
// Store groups in session for later use (e.g., pending approval page)
275+
$request->session()->put('keycloak_groups', $keycloakUser->groups);
276+
268277
// Extract canton from groups and find corresponding group model for managed_by
269278
$cantonCode = CantonEmailService::extractCantonFromGroups($keycloakUser->groups);
270279
$cantonGroup = GroupController::findCantonGroup($cantonCode);

resources/lang/de/approval.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
return [
44
'waiting' => 'Auf Genehmigung warten',
55
'confirmation' => "Wir haben deinen Antrag erhalten und wir werden ihn so bald wie möglich genehmigen. Da dies von einem Menschen erledigt wird, kann es eine Weile dauern. Wir senden dir eine E-Mail, sobald dein Zugang bereit ist.",
6-
'contact' => "Bitte kontaktiere uns, wenn Du vor mehr als zwei Wochen eine Anfrage gestellt hast und dich noch immer nicht einloggen kannst.",
6+
'contact' => "Bitte kontaktiere deine kantonale Geschäftsstelle, wenn Du vor mehr als zwei Wochen eine Anfrage gestellt hast und dich noch immer nicht einloggen kannst.",
77
];

resources/lang/en/approval.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
return [
44
'waiting' => 'Waiting for approval',
55
'confirmation' => "We've received your registration and we'll approve it as soon as possible. Since this is done manually, it may take a little while. We'll send you an email, as soon as your account is ready.",
6-
'contact' => "Please contact us, if you're request was more than two weeks ago, and you still can't log in.",
6+
'contact' => "Please contact your cantonal office, if you're request was more than two weeks ago, and you still can't log in.",
77
];

resources/lang/fr/approval.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
return [
44
'waiting' => 'En attente de validation',
55
'confirmation' => "Nous avons reçu votre inscription et nous l'approuverons dès que possible. Comme cela est fait manuellement, cela peut prendre un peu de temps. Nous vous enverrons un e-mail dès que votre compte sera prêt.",
6-
'contact' => "Veuillez nous contacter, si vous avez demandé il y a plus de deux semaines, et vous ne pouvez toujours pas vous connecter.",
6+
'contact' => "Veuillez contacter votre bureau cantonal, si vous avez demandé il y a plus de deux semaines, et vous ne pouvez toujours pas vous connecter.",
77
];

resources/views/auth/approval.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
{{ __('approval.confirmation') }}
1010
<br><br>
1111
{{ __('approval.contact') }}
12-
<a href="mailto:{{ config('app.admin_email') }}">{{ config('app.admin_email') }}</a>
12+
<a href="mailto:{{ $cantonEmail }}">{{ $cantonEmail }}</a>
1313
</p>
1414
</div>
1515
</div>

0 commit comments

Comments
 (0)