Skip to content

Commit

Permalink
Merge pull request #200 from blindsidenetworks/limit-user-name
Browse files Browse the repository at this point in the history
Added max length for external user name
  • Loading branch information
harshilsharma63 authored Dec 8, 2021
2 parents bc3fe7f + cdcc1a2 commit 60e85c0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion assets/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@
<form>
<div class="fieldRow name">
<label for="name">Name</label>
<input id="name" name="name" placeholder="Enter your name"/>
<input id="name" name="name" placeholder="Enter your name" maxlength="128"/>
</div>
<div class="fieldRow rememberName">
<input type="checkbox" id="rememberName" name="rememberName"/>
Expand Down
7 changes: 7 additions & 0 deletions server/responsehandlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ import (
"github.com/mattermost/mattermost-server/v5/model"
)

const (
externalUsernameMaxLength = 128
)

type RequestCreateMeetingJSON struct {
UserId string `json:"user_id"`
ChannelId string `json:"channel_id"`
Expand Down Expand Up @@ -459,6 +463,9 @@ func (p *Plugin) handleJoinMeetingExternalUser(w http.ResponseWriter, r *http.Re
}

username := request["name"]
if len(username) > externalUsernameMaxLength {
username = username[:externalUsernameMaxLength-1]
}

// golang doesnt have sets so have to iterate through array to check if meeting participant is already in meeeting
if !IsItemInArray(username, meetingpointer.AttendeeNames) {
Expand Down

0 comments on commit 60e85c0

Please sign in to comment.