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