forked from External/greenlight
meeting and user name character limits
This commit is contained in:
parent
8767788d3e
commit
f89bca5967
|
@ -81,6 +81,7 @@ body[data-controller=landing].app-background {
|
|||
|
||||
.panel {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.input-spacing {
|
||||
|
|
|
@ -20,6 +20,8 @@ require 'digest/sha1'
|
|||
class ApplicationController < ActionController::Base
|
||||
protect_from_forgery with: :exception
|
||||
before_action :set_locale
|
||||
MEETING_NAME_LIMIT = 200
|
||||
USER_NAME_LIMIT = 100
|
||||
|
||||
def set_locale
|
||||
I18n.locale = http_accept_language.language_region_compatible_from(I18n.available_locales)
|
||||
|
@ -34,4 +36,14 @@ class ApplicationController < ActionController::Base
|
|||
Rails.configuration.relative_url_root || ""
|
||||
end
|
||||
helper_method :relative_root
|
||||
|
||||
def meeting_name_limit
|
||||
MEETING_NAME_LIMIT
|
||||
end
|
||||
helper_method :meeting_name_limit
|
||||
|
||||
def user_name_limit
|
||||
USER_NAME_LIMIT
|
||||
end
|
||||
helper_method :user_name_limit
|
||||
end
|
||||
|
|
|
@ -32,6 +32,18 @@ class BbbController < ApplicationController
|
|||
message: "user name was not included",
|
||||
status: :unprocessable_entity
|
||||
)
|
||||
elsif params[:name].size > user_name_limit
|
||||
return render_bbb_response(
|
||||
messageKey: "invalid_parameter",
|
||||
message: "user name is too long",
|
||||
status: :unprocessable_entity
|
||||
)
|
||||
elsif params[:id].size > meeting_name_limit
|
||||
return render_bbb_response(
|
||||
messageKey: "invalid_parameter",
|
||||
message: "meeting name is too long",
|
||||
status: :unprocessable_entity
|
||||
)
|
||||
else
|
||||
if params[:room_id]
|
||||
user = User.find_by encrypted_id: params[:room_id]
|
||||
|
|
|
@ -21,7 +21,9 @@ class LandingController < ApplicationController
|
|||
end
|
||||
|
||||
def resource
|
||||
if params[:resource] == 'meetings'
|
||||
if params[:id].size > meeting_name_limit
|
||||
redirect_to action: :index
|
||||
elsif params[:resource] == 'meetings'
|
||||
render_meeting
|
||||
elsif params[:resource] == 'rooms'
|
||||
render_room
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
|
||||
<!-- if not signed in show field to enter name -->
|
||||
<% else %>
|
||||
<%= text_field_tag 'user[name]', '', class: 'form-control meeting-user-name', placeholder: t('enter_name') %>
|
||||
<%= text_field_tag 'user[name]', '', class: 'form-control meeting-user-name', placeholder: t('enter_name'), maxlength: user_name_limit %>
|
||||
<span class="input-group-btn">
|
||||
<button type="button" class="btn btn-primary center-block meeting-join">
|
||||
<%= t('join') %>
|
||||
|
|
|
@ -14,5 +14,5 @@
|
|||
%>
|
||||
|
||||
<div class="meeting-name-form-wrapper">
|
||||
<input type="text" class="form-control meeting-name" placeholder="<%= t('enter_meeting_name') %>"/>
|
||||
<input type="text" class="form-control meeting-name" placeholder="<%= t('enter_meeting_name') %>" maxlength="<%= meeting_name_limit %>"/>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue