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_authentification()
		flash.now[:notice] = I18n.t 'login.success'
		render 'new'
	end

	def destroy
		self.remove_old_session(session[:token])
	end
end