app/controllers/sessions_controller.rb
7aef87db
 class SessionsController < ApplicationController
 	def new
 
 	end
 
 	def create
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
81ab4d54
         Token.remove_token(session[:token])
         remove_session()
 
         redirect_to root_path
7aef87db
 	end
 end