mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	Revert "Prevent a user with a different email from accepting the team invite" (#24531)
Reverts go-gitea/gitea#24491
This commit is contained in:
		@@ -2561,7 +2561,6 @@ teams.all_repositories_admin_permission_desc = This team grants <strong>Admin</s
 | 
				
			|||||||
teams.invite.title = You've been invited to join team <strong>%s</strong> in organization <strong>%s</strong>.
 | 
					teams.invite.title = You've been invited to join team <strong>%s</strong> in organization <strong>%s</strong>.
 | 
				
			||||||
teams.invite.by = Invited by %s
 | 
					teams.invite.by = Invited by %s
 | 
				
			||||||
teams.invite.description = Please click the button below to join the team.
 | 
					teams.invite.description = Please click the button below to join the team.
 | 
				
			||||||
teams.invite.email_mismatch = Your email address does not match this invite.
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
[admin]
 | 
					[admin]
 | 
				
			||||||
dashboard = Dashboard
 | 
					dashboard = Dashboard
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -552,7 +552,6 @@ func TeamInvite(ctx *context.Context) {
 | 
				
			|||||||
	ctx.Data["Organization"] = org
 | 
						ctx.Data["Organization"] = org
 | 
				
			||||||
	ctx.Data["Team"] = team
 | 
						ctx.Data["Team"] = team
 | 
				
			||||||
	ctx.Data["Inviter"] = inviter
 | 
						ctx.Data["Inviter"] = inviter
 | 
				
			||||||
	ctx.Data["EmailMismatch"] = ctx.Doer.Email != invite.Email
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ctx.HTML(http.StatusOK, tplTeamInvite)
 | 
						ctx.HTML(http.StatusOK, tplTeamInvite)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -569,13 +568,6 @@ func TeamInvitePost(ctx *context.Context) {
 | 
				
			|||||||
		return
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// check that the Doer is the invitee
 | 
					 | 
				
			||||||
	if ctx.Doer.Email != invite.Email {
 | 
					 | 
				
			||||||
		log.Info("invite %d does not apply to the current user %d", invite.ID, ctx.Doer.ID)
 | 
					 | 
				
			||||||
		ctx.NotFound("ErrTeamInviteNotFound", err)
 | 
					 | 
				
			||||||
		return
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if err := models.AddTeamMember(team, ctx.Doer.ID); err != nil {
 | 
						if err := models.AddTeamMember(team, ctx.Doer.ID); err != nil {
 | 
				
			||||||
		ctx.ServerError("AddTeamMember", err)
 | 
							ctx.ServerError("AddTeamMember", err)
 | 
				
			||||||
		return
 | 
							return
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,23 +6,17 @@
 | 
				
			|||||||
			<div class="image">
 | 
								<div class="image">
 | 
				
			||||||
				{{avatar $.Context .Organization 140}}
 | 
									{{avatar $.Context .Organization 140}}
 | 
				
			||||||
			</div>
 | 
								</div>
 | 
				
			||||||
			{{if .EmailMismatch}}
 | 
								<div class="content">
 | 
				
			||||||
				<div class="content">
 | 
									<div class="header">{{.locale.Tr "org.teams.invite.title" .Team.Name .Organization.Name | Str2html}}</div>
 | 
				
			||||||
					<div class="header">{{.locale.Tr "org.teams.invite.email_mismatch"}}</div>
 | 
									<div class="meta">{{.locale.Tr "org.teams.invite.by" .Inviter.Name}}</div>
 | 
				
			||||||
				</div>
 | 
									<div class="description">{{.locale.Tr "org.teams.invite.description"}}</div>
 | 
				
			||||||
			{{else}}
 | 
								</div>
 | 
				
			||||||
				<div class="content">
 | 
								<div class="extra content">
 | 
				
			||||||
					<div class="header">{{.locale.Tr "org.teams.invite.title" .Team.Name .Organization.Name | Str2html}}</div>
 | 
									<form class="ui form" action="" method="post">
 | 
				
			||||||
					<div class="meta">{{.locale.Tr "org.teams.invite.by" .Inviter.Name}}</div>
 | 
										{{.CsrfTokenHtml}}
 | 
				
			||||||
					<div class="description">{{.locale.Tr "org.teams.invite.description"}}</div>
 | 
										<button class="fluid ui green button">{{.locale.Tr "org.teams.join"}}</button>
 | 
				
			||||||
				</div>
 | 
									</form>
 | 
				
			||||||
				<div class="extra content">
 | 
								</div>
 | 
				
			||||||
					<form class="ui form" action="" method="post">
 | 
					 | 
				
			||||||
						{{.CsrfTokenHtml}}
 | 
					 | 
				
			||||||
						<button class="fluid ui green button">{{.locale.Tr "org.teams.join"}}</button>
 | 
					 | 
				
			||||||
					</form>
 | 
					 | 
				
			||||||
				</div>
 | 
					 | 
				
			||||||
			{{end}}
 | 
					 | 
				
			||||||
		</div>
 | 
							</div>
 | 
				
			||||||
	</div>
 | 
						</div>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user