fix waiting to join retry logic

This commit is contained in:
Joshua Arts 2018-06-28 10:39:39 -04:00
parent d9c5d37810
commit c802e4806a
2 changed files with 6 additions and 4 deletions

View File

@ -10,7 +10,9 @@ $(document).on("turbolinks:load", function(){
uid: $(".background").attr("room")
}, {
received: function(data){
if(data.action = "started"){ request_to_join_meeting(); }
if(data.action = "started"){
request_to_join_meeting();
}
}
});
}
@ -29,8 +31,8 @@ var request_to_join_meeting = function(){
'Content-Type': 'application/x-www-form-urlencoded',
'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content')
},
error: function(){
// The meeting is still booting (going slowly), retry shortly.
success: function(){
// Enqueue another trial just incase they didn't actually join.
if(join_attempts < 4){ setTimeout(request_to_join_meeting, 10000); }
join_attempts++;
}

View File

@ -17,7 +17,7 @@ class SessionsController < ApplicationController
# POST /users/login
def create
user = User.find_by(email: session_params[:email])
if user&.authenticate(session_params[:password])
if user.try(:authenticate, session_params[:password])
login(user)
else
redirect_to root_path, notice: LOGIN_FAILED