class SessionsController < ApplicationController def new end def create require_dependency "signin.rb" begin Signin.try_login(params[:jid].downcase, params[:password]) rescue Signin::LoginError flash.now[:error] = I18n.t 'login.error' return render 'new' end create_new_authentication(params[:jid].downcase) redirect_to chat_path, flash: {notice: I18n.t('login.success')} end def destroy self.remove_old_session(session[:token]) end end