chore: change in error message on register (#1068)

This commit is contained in:
Ankit Nayan 2022-05-04 17:33:54 +05:30 committed by GitHub
parent 8a7cbc8ad3
commit 67b4290846
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -125,7 +125,11 @@ func validateInvite(ctx context.Context, req *RegisterRequest) (*model.Invitatio
return nil, errors.Wrap(err.Err, "Failed to read from DB")
}
if invitation == nil || invitation.Token != req.InviteToken {
if invitation == nil {
return nil, ErrorAskAdmin
}
if invitation.Token != req.InviteToken {
return nil, ErrorInvalidInviteToken
}

View File

@ -15,6 +15,7 @@ var (
ErrorInvalidRole = errors.New("Invalid role")
ErrorInvalidInviteToken = errors.New("Invalid invite token")
ErrorAskAdmin = errors.New("You are not allowed to create an account. Please ask your admin to send an invite link")
)
func randomHex(sz int) (string, error) {