forked from External/greenlight
validate passwords and fix home
This commit is contained in:
parent
520c489e62
commit
4f70c9a8e5
|
@ -57,6 +57,8 @@ a {
|
||||||
}
|
}
|
||||||
|
|
||||||
.room-section {
|
.room-section {
|
||||||
|
position: relative;
|
||||||
|
height: 45%;
|
||||||
background-color: $background-color;
|
background-color: $background-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,8 +98,9 @@ iframe{
|
||||||
}
|
}
|
||||||
|
|
||||||
.feature-stamp {
|
.feature-stamp {
|
||||||
width: 100px;
|
width: 7vw;
|
||||||
height: 100px;
|
height: 7vw;
|
||||||
|
font-size: 1vw;
|
||||||
}
|
}
|
||||||
|
|
||||||
html, body {
|
html, body {
|
||||||
|
@ -106,12 +109,16 @@ html, body {
|
||||||
background-color: white;
|
background-color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.resp-header {
|
||||||
|
font-size: 3.3vw;
|
||||||
|
}
|
||||||
|
|
||||||
.font-weight-400 {
|
.font-weight-400 {
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wrapper {
|
.wrapper {
|
||||||
min-height: calc(100% - #{$footer-height});
|
height: calc(100% - #{$footer-height});
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,12 @@ class ApplicationController < ActionController::Base
|
||||||
end
|
end
|
||||||
helper_method :owner_meeting_url
|
helper_method :owner_meeting_url
|
||||||
|
|
||||||
|
# Determines if a form field needs the is-invalid class.
|
||||||
|
def form_is_invalid?(obj, key)
|
||||||
|
'is-invalid' if !obj.errors.messages[key].empty?
|
||||||
|
end
|
||||||
|
helper_method :form_is_invalid?
|
||||||
|
|
||||||
# Default, unconfigured meeting options.
|
# Default, unconfigured meeting options.
|
||||||
def default_meeting_options
|
def default_meeting_options
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
class RoomsController < ApplicationController
|
class RoomsController < ApplicationController
|
||||||
|
|
||||||
before_action :find_room, except: :create
|
before_action :find_room, except: :create
|
||||||
|
before_action :verify_room_ownership, only: [:start, :destroy, :home]
|
||||||
#before_action :verify_room_ownership
|
|
||||||
#skip_before_action :verify_room_ownership, only: [:create, :show, :join, :wait]
|
|
||||||
|
|
||||||
# POST /r
|
# POST /r
|
||||||
def create
|
def create
|
||||||
|
|
|
@ -5,14 +5,14 @@ class UsersController < ApplicationController
|
||||||
|
|
||||||
# POST /users
|
# POST /users
|
||||||
def create
|
def create
|
||||||
user = User.new(user_params)
|
@user = User.new(user_params)
|
||||||
user.provider = "greenlight"
|
@user.provider = "greenlight"
|
||||||
|
|
||||||
if user.save
|
if @user.save
|
||||||
login(user)
|
login(@user)
|
||||||
else
|
else
|
||||||
# Handle error on user creation.
|
# Handle error on user creation.
|
||||||
|
render :new
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -12,10 +12,9 @@ class User < ApplicationRecord
|
||||||
uniqueness: { case_sensitive: false },
|
uniqueness: { case_sensitive: false },
|
||||||
format: {with: /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i }
|
format: {with: /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i }
|
||||||
|
|
||||||
validates :password, length: { minimum: 6 }, allow_nil: true
|
validates :password, length: { minimum: 6 }, presence: true, confirmation: true, if: :greenlight_account?
|
||||||
|
|
||||||
# We don't want to run the validations because they require a user
|
# We don't want to require password validations on all accounts.
|
||||||
# to have a password. Users who authenticate via omniauth won't.
|
|
||||||
has_secure_password(validations: false)
|
has_secure_password(validations: false)
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
|
@ -90,6 +89,10 @@ class User < ApplicationRecord
|
||||||
name.split(' ').first
|
name.split(' ').first
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def greenlight_account?
|
||||||
|
provider == "greenlight"
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
# Initializes a room for the user and assign a BigBlueButton user id.
|
# Initializes a room for the user and assign a BigBlueButton user id.
|
||||||
|
|
|
@ -8,10 +8,7 @@
|
||||||
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="app-background" data-controller="<%= params[:controller] %>" data-action="<%= params[:action] %>"
|
<body class="app-background" data-controller="<%= params[:controller] %>" data-action="<%= params[:action] %>">
|
||||||
data-resource="<%= params[:resource] %>"
|
|
||||||
data-current-user="<%= current_user.try(:encrypted_id) %>">
|
|
||||||
|
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
|
|
||||||
<!-- Messages -->
|
<!-- Messages -->
|
||||||
|
|
|
@ -1,37 +1,14 @@
|
||||||
<div class="room-section pb-2 pt-9">
|
<div class="room-section">
|
||||||
|
<div class="d-flex align-items-center" style="height: 100%;">
|
||||||
<div class="container text-center">
|
<div class="container text-center">
|
||||||
|
<h1 id="main-text" class="font-weight-400 resp-header">Welcome to BigBlueButton.</h1>
|
||||||
<h1 id="main-text" class="display-3 font-weight-400">Welcome to BigBlueButton.</h1>
|
|
||||||
<h4 class="text-muted">A simple front end for your BigBlueButton Open Source Web Conferencing Server.</h4>
|
<h4 class="text-muted">A simple front end for your BigBlueButton Open Source Web Conferencing Server.</h4>
|
||||||
|
|
||||||
<%= link_to "https://www.youtube.com/watch?v=yGX3JCv7OVM&feature=youtu.be", class: "p-3", target: "_blank" do %>
|
<%= link_to "https://www.youtube.com/watch?v=yGX3JCv7OVM&feature=youtu.be", class: "p-3", target: "_blank" do %>
|
||||||
<h4>Watch a tutorial on using Greenlight <i class="fe fe-play-circle"></i></h4>
|
<h4>Watch a tutorial on using Greenlight <i class="fe fe-play-circle"></i></h4>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%= render "shared/features" %>
|
<%= render "shared/features" %>
|
||||||
|
|
||||||
<script>
|
|
||||||
/*
|
|
||||||
textOptions = [
|
|
||||||
"Start your own Meeting.",
|
|
||||||
"Collaborate with Friends.",
|
|
||||||
"Connect in Real-Time.",
|
|
||||||
"Teach Students Online.",
|
|
||||||
]
|
|
||||||
|
|
||||||
textOpt = 0
|
|
||||||
|
|
||||||
var changeText = function(){
|
|
||||||
$('#main-text').text(textOptions[textOpt]);
|
|
||||||
$('#main-text').fadeIn(1000)
|
|
||||||
textOpt++;
|
|
||||||
if (textOpt > textOptions.length) { textOpt = 0; }
|
|
||||||
}
|
|
||||||
|
|
||||||
setInterval(function(){
|
|
||||||
$('#main-text').fadeOut(1000, changeText)
|
|
||||||
}, 7000);
|
|
||||||
*/
|
|
||||||
</script>
|
|
||||||
|
|
|
@ -6,29 +6,26 @@
|
||||||
<h4 class="mt-2">Create an Account</h4>
|
<h4 class="mt-2">Create an Account</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<%= form_for @user, method: :post do |f| %>
|
<%= form_for @user, url: create_user_path, method: :post do |f| %>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<%= f.label "Fullname", class: "form-label" %>
|
<%= f.label "Fullname", class: "form-label" %>
|
||||||
<div class="input-icon">
|
<%= f.text_field :name, class: "form-control #{form_is_invalid?(@user, :name)}", placeholder: "Fullname" %>
|
||||||
<span class="input-icon-addon">
|
<div class="invalid-feedback d-block"><%= @user.errors.full_messages_for(:name).first %></div>
|
||||||
<i class="fas fa-user"></i>
|
|
||||||
</span>
|
|
||||||
<%= f.text_field :name, class: "form-control", placeholder: "Fullname" %>
|
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<div class="form-group">
|
||||||
<%= f.label "Email", class: "form-label" %>
|
<%= f.label "Email", class: "form-label" %>
|
||||||
<div class="input-icon">
|
<%= f.text_field :email, class: "form-control #{form_is_invalid?(@user, :email)}", placeholder: "Email" %>
|
||||||
<span class="input-icon-addon">
|
<div class="invalid-feedback d-block"><%= @user.errors.full_messages_for(:email).first %></div>
|
||||||
<i class="fas fa-at"></i>
|
|
||||||
</span>
|
|
||||||
<%= f.text_field :email, class: "form-control", placeholder: "Email" %>
|
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<div class="form-group">
|
||||||
<%= f.label "Password", class: "form-label" %>
|
<%= f.label "Password", class: "form-label" %>
|
||||||
<%= f.password_field :password, class: "form-control", placeholder: "Password" %>
|
<%= f.password_field :password, class: "form-control #{form_is_invalid?(@user, :password)}", placeholder: "Password" %>
|
||||||
<br>
|
<div class="invalid-feedback d-block"><%= @user.errors.full_messages_for(:password).first %></div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
<%= f.label "Password Confirmation", class: "form-label" %>
|
<%= f.label "Password Confirmation", class: "form-label" %>
|
||||||
<%= f.password_field :password, class: "form-control", placeholder: "Password Confirmation" %>
|
<%= f.password_field :password_confirmation, class: "form-control #{form_is_invalid?(@user, :password_confirmation)}", placeholder: "Password Confirmation" %>
|
||||||
|
<div class="invalid-feedback d-block"><%= @user.errors.full_messages_for(:password_confirmation).first %></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-footer">
|
<div class="card-footer">
|
||||||
<%= f.submit "Sign up", class: "btn btn-primary float-right" %>
|
<%= f.submit "Sign up", class: "btn btn-primary float-right" %>
|
||||||
|
|
|
@ -18,8 +18,8 @@ Rails.application.routes.draw do
|
||||||
end
|
end
|
||||||
|
|
||||||
# User resources.
|
# User resources.
|
||||||
resources :users, only: [:create], param: :user_uid
|
|
||||||
get '/signup', to: 'users#new', as: :signup
|
get '/signup', to: 'users#new', as: :signup
|
||||||
|
post '/signup', to: 'users#create', as: :create_user
|
||||||
get '/users/:user_uid/edit', to: 'users#edit', as: :edit_user
|
get '/users/:user_uid/edit', to: 'users#edit', as: :edit_user
|
||||||
patch '/users/:user_uid/edit', to: 'users#update', as: :update_user
|
patch '/users/:user_uid/edit', to: 'users#update', as: :update_user
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue