File tree 3 files changed +26
-11
lines changed
3 files changed +26
-11
lines changed Original file line number Diff line number Diff line change @@ -2559,6 +2559,7 @@ teams.all_repositories_admin_permission_desc = This team grants <strong>Admin</s
2559
2559
teams.invite.title = You' ve been invited to join team <strong>%s</strong> in organization <strong>%s</strong>.
2560
2560
teams.invite.by = Invited by %s
2561
2561
teams.invite.description = Please click the button below to join the team.
2562
+ teams.invite.email_mismatch = Your email address does not match this invite.
2562
2563
2563
2564
[admin]
2564
2565
dashboard = Dashboard
Original file line number Diff line number Diff line change @@ -552,6 +552,7 @@ func TeamInvite(ctx *context.Context) {
552
552
ctx .Data ["Organization" ] = org
553
553
ctx .Data ["Team" ] = team
554
554
ctx .Data ["Inviter" ] = inviter
555
+ ctx .Data ["EmailMismatch" ] = ctx .Doer .Email != invite .Email
555
556
556
557
ctx .HTML (http .StatusOK , tplTeamInvite )
557
558
}
@@ -568,6 +569,13 @@ func TeamInvitePost(ctx *context.Context) {
568
569
return
569
570
}
570
571
572
+ // check that the Doer is the invitee
573
+ if ctx .Doer .Email != invite .Email {
574
+ log .Info ("invite %d does not apply to the current user %d" , invite .ID , ctx .Doer .ID )
575
+ ctx .NotFound ("ErrTeamInviteNotFound" , err )
576
+ return
577
+ }
578
+
571
579
if err := models .AddTeamMember (team , ctx .Doer .ID ); err != nil {
572
580
ctx .ServerError ("AddTeamMember" , err )
573
581
return
Original file line number Diff line number Diff line change 6
6
<div class="image">
7
7
{{avatar $.Context .Organization 140}}
8
8
</div>
9
- <div class="content">
10
- <div class="header">{{.locale.Tr "org.teams.invite.title" .Team.Name .Organization.Name | Str2html}}</div>
11
- <div class="meta">{{.locale.Tr "org.teams.invite.by" .Inviter.Name}}</div>
12
- <div class="description">{{.locale.Tr "org.teams.invite.description"}}</div>
13
- </div>
14
- <div class="extra content">
15
- <form class="ui form" action="" method="post">
16
- {{.CsrfTokenHtml}}
17
- <button class="fluid ui green button">{{.locale.Tr "org.teams.join"}}</button>
18
- </form>
19
- </div>
9
+ {{if .EmailMismatch}}
10
+ <div class="content">
11
+ <div class="header">{{.locale.Tr "org.teams.invite.email_mismatch"}}</div>
12
+ </div>
13
+ {{else}}
14
+ <div class="content">
15
+ <div class="header">{{.locale.Tr "org.teams.invite.title" .Team.Name .Organization.Name | Str2html}}</div>
16
+ <div class="meta">{{.locale.Tr "org.teams.invite.by" .Inviter.Name}}</div>
17
+ <div class="description">{{.locale.Tr "org.teams.invite.description"}}</div>
18
+ </div>
19
+ <div class="extra content">
20
+ <form class="ui form" action="" method="post">
21
+ {{.CsrfTokenHtml}}
22
+ <button class="fluid ui green button">{{.locale.Tr "org.teams.join"}}</button>
23
+ </form>
24
+ </div>
25
+ {{end}}
20
26
</div>
21
27
</div>
22
28
</div>
You can’t perform that action at this time.
0 commit comments