mirror of
https://github.com/andwati/dokploy.git
synced 2026-10-21 12:34:29 +00:00
fix: validate invitation expiry and status on signup
Also checks that the invitation is not expired and has not already been used before allowing account creation. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
17393af717
commit
04ffa43008
@@ -154,6 +154,16 @@ const { handler, api } = betterAuth({
|
||||
message: "User not found",
|
||||
});
|
||||
}
|
||||
if (invitation.isExpired) {
|
||||
throw new APIError("BAD_REQUEST", {
|
||||
message: "Invitation has expired",
|
||||
});
|
||||
}
|
||||
if (invitation.status !== "pending") {
|
||||
throw new APIError("BAD_REQUEST", {
|
||||
message: "Invitation has already been used",
|
||||
});
|
||||
}
|
||||
if (_user.email !== invitation.email) {
|
||||
throw new APIError("BAD_REQUEST", {
|
||||
message: "Email does not match invitation",
|
||||
|
||||
Reference in New Issue
Block a user