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