Skip to content

Commit 5628e2d

Browse files
authored
Merge pull request #187 from ht3aa/cursor/2026-04-04-gitea-credentials-mailtrap
Send new Gitea account credentials via Mailtrap
2 parents ab0e4e3 + b1a4e2d commit 5628e2d

39 files changed

Lines changed: 299 additions & 142 deletions
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?php
2+
3+
namespace App\Notifications;
4+
5+
use App\Notifications\Channels\MailtrapChannel;
6+
use App\Notifications\Messages\MailtrapMessage;
7+
use Illuminate\Bus\Queueable;
8+
use Illuminate\Contracts\Queue\ShouldQueue;
9+
use Illuminate\Notifications\Notification;
10+
use Illuminate\Support\Facades\View;
11+
12+
class GiteaAccountCredentialsNotification extends Notification implements ShouldQueue
13+
{
14+
use Queueable;
15+
16+
public function __construct(
17+
public string $giteaUsername,
18+
public string $temporaryPassword,
19+
) {}
20+
21+
/**
22+
* @return array<int, string>
23+
*/
24+
public function via(object $notifiable): array
25+
{
26+
return [MailtrapChannel::class];
27+
}
28+
29+
public function toMailtrap(object $notifiable): MailtrapMessage
30+
{
31+
$giteaUrl = config('services.gitea.url');
32+
33+
$html = View::make('emails.gitea-account-credentials', [
34+
'user' => $notifiable,
35+
'giteaUsername' => $this->giteaUsername,
36+
'temporaryPassword' => $this->temporaryPassword,
37+
'giteaUrl' => $giteaUrl,
38+
])->render();
39+
40+
$textLines = [
41+
'A Gitea account has been created for you on '.config('app.name').'.',
42+
'',
43+
'Username: '.$this->giteaUsername,
44+
'Temporary password: '.$this->temporaryPassword,
45+
'',
46+
'You must change this password when you first sign in to Gitea.',
47+
];
48+
49+
if (filled($giteaUrl)) {
50+
$textLines[] = '';
51+
$textLines[] = 'Sign in: '.rtrim((string) $giteaUrl, '/');
52+
}
53+
54+
return MailtrapMessage::create()
55+
->subject('Your Gitea account credentials')
56+
->text(implode("\n", $textLines))
57+
->html($html)
58+
->category('Gitea Account');
59+
}
60+
}

app/Services/CompanyJobGiteaProvisioner.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use App\Models\CompanyJobApplication;
77
use App\Models\Developer;
88
use App\Models\User;
9+
use App\Notifications\GiteaAccountCredentialsNotification;
910
use Illuminate\Support\Str;
1011
use RuntimeException;
1112

@@ -117,6 +118,8 @@ public function ensureUserHasGiteaAccount(User $user): void
117118
}
118119

119120
$user->forceFill(['gitea_username' => $login])->save();
121+
122+
$user->notify(new GiteaAccountCredentialsNotification($login, $password));
120123
}
121124

122125
/**

public/build/assets/Appearance-BpaRbKLR.js renamed to public/build/assets/Appearance-DM4M8juV.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/build/assets/BadgeIcon.vue_vue_type_script_setup_true_lang-DNE6msv0.js renamed to public/build/assets/BadgeIcon.vue_vue_type_script_setup_true_lang-C4NPYUiB.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/build/assets/DeveloperCard.vue_vue_type_script_setup_true_lang-C3hiDJqO.js renamed to public/build/assets/DeveloperCard.vue_vue_type_script_setup_true_lang-g6a-KgnL.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/build/assets/DeveloperCardSection-ByWs1UIH.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)