Skip to content

Commit 4e48a2d

Browse files
committed
Fix: pass role variable to ResendInviteService
1 parent 020504d commit 4e48a2d

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

accounts/src/main/java/org/restheart/accounts/ResendInviteService.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,11 @@ public void handle(JsonRequest req, JsonResponse res) {
129129
return;
130130
}
131131
var invite = inviteOpt.get();
132+
133+
// 7. Read the role from the stored invitation
134+
var inviteRole = invite.containsKey("role") && invite.get("role").isString()
135+
? invite.getString("role").getValue()
136+
: conf.memberRoleName();
132137
var isNewUser = invite.containsKey("isNewUser") && invite.getBoolean("isNewUser").getValue();
133138

134139
// 5. Generate new token (invalidates the previous one)
@@ -180,7 +185,8 @@ public void handle(JsonRequest req, JsonResponse res) {
180185
"frontend-url", conf.frontendUrl(),
181186
"invite-url", link,
182187
"inviter-name", inviterName != null ? inviterName : "",
183-
"team-name", teamName != null ? teamName : "");
188+
"team-name", teamName != null ? teamName : "",
189+
"role", inviteRole.substring(0, 1).toUpperCase() + inviteRole.substring(1));
184190
var rendered = EmailRenderer.render(tmpl, vars, conf.defaultLocale());
185191
ermes.sendEmail(email, email, rendered.subject(), rendered.htmlBody());
186192
}

accounts/src/main/resources/email-templates/invite.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
</p>
4141

4242
<p style="margin:0 0 24px;font-size:15px;line-height:1.6;color:#374151;">
43-
<span lang="en"><strong>{{inviter-name}}</strong> has invited you to join <strong>{{team-name}}</strong> on {{app-name}}.<br>Click the button below to accept and set your password.</span>
44-
<span lang="it"><strong>{{inviter-name}}</strong> ti ha invitato a far parte di <strong>{{team-name}}</strong> su {{app-name}}.<br>Clicca il pulsante qui sotto per accettare e impostare la tua password.</span>
43+
<span lang="en"><strong>{{inviter-name}}</strong> has invited you to join <strong>{{team-name}}</strong> on {{app-name}} as a <strong>{{role}}</strong>.<br>Click the button below to accept and set your password.</span>
44+
<span lang="it"><strong>{{inviter-name}}</strong> ti ha invitato a far parte di <strong>{{team-name}}</strong> su {{app-name}} come <strong>{{role}}</strong>.<br>Clicca il pulsante qui sotto per accettare e impostare la tua password.</span>
4545
</p>
4646

4747
<table class="btn-wrap" cellpadding="0" cellspacing="0" style="margin:0 0 32px;">

0 commit comments

Comments
 (0)