{satellite/console,web/satellite}: trim emails when inviting members

This change trims whitespace from email addresses in project member
invitation requests.

Change-Id: Idd9116820897bf29f3eeba8cf95770b1aa14690c
This commit is contained in:
Jeremy Wharton 2023-07-09 23:28:18 -05:00 committed by Storj Robot
parent 0f9a0ba9cd
commit fbda13c752
2 changed files with 7 additions and 0 deletions

View File

@ -7,6 +7,7 @@ import (
"encoding/base64"
"encoding/json"
"net/http"
"strings"
"time"
"github.com/gorilla/mux"
@ -91,6 +92,10 @@ func (p *Projects) InviteUsers(w http.ResponseWriter, r *http.Request) {
return
}
for i, email := range data.Emails {
data.Emails[i] = strings.TrimSpace(email)
}
_, err = p.service.InviteProjectMembers(ctx, id, data.Emails)
if err != nil {
p.serveJSONError(w, http.StatusInternalServerError, err)

View File

@ -146,6 +146,8 @@ async function onAddUsersClick(): Promise<void> {
let areAllEmailsValid = true;
const emailArray: string[] = [];
inputs.value.forEach(elem => elem.value = elem.value.trim());
for (let i = 0; i < length; i++) {
const element = inputs.value[i];
const isEmail = Validator.email(element.value);