diff --git a/app/controllers/sso_login_box_controller.rb b/app/controllers/sso_login_box_controller.rb index 294162e..ff1f9cf 100644 --- a/app/controllers/sso_login_box_controller.rb +++ b/app/controllers/sso_login_box_controller.rb @@ -1,30 +1,3 @@ -require 'mcrypt' class SsoLoginBoxController < SessionsController - def tku_login - redirect_to root_url and return if !params[:t].present? - str_decoded = Base64.decode64(params[:sso_userid].to_s) - mc = Mcrypt.new(:des,:ecb) - mc.padding = :pkcs - mc.key = "3M7PvTSE" - plain = mc.decrypt(str_decoded) - t = mc.decrypt(Base64.decode64(params[:t])).to_i - nt = DateTime.now.to_time.to_i - if (nt - t) < 10 - user = MemberProfile.where(:sid => plain).first.user rescue nil - if !user.nil? - session[:user_id] = user.id - session[:login_referer] = nil - if params[:referer_url] - redirect_to URI.parse(params[:referer_url]).path - else - redirect_to admin_dashboards_path - end - else - flash.now.alert = "User not found." - render "new" - end - else - redirect_to root_url - end - end + end \ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml new file mode 100644 index 0000000..4b8bab8 --- /dev/null +++ b/config/locales/en.yml @@ -0,0 +1,2 @@ +en: + nccu_lib_login: Library acoount login \ No newline at end of file diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml new file mode 100644 index 0000000..c39121a --- /dev/null +++ b/config/locales/zh_tw.yml @@ -0,0 +1,2 @@ +zh_tw: + nccu_lib_login: 圖書館帳號登入 \ No newline at end of file diff --git a/lib/sso_login_box/engine.rb b/lib/sso_login_box/engine.rb index ad1cd16..b1bdf17 100644 --- a/lib/sso_login_box/engine.rb +++ b/lib/sso_login_box/engine.rb @@ -4,7 +4,7 @@ module SsoLoginBox initializer "sso_login_box" do OrbitApp.registration "SsoLoginBox", :type => "ModuleApp" do base_url File.expand_path File.dirname(__FILE__) - set_keyword_contstraints ['/sso/tku_redirect'] + #set_keyword_contstraints ['/sso/tku_redirect'] end end end diff --git a/lib/sso_login_box/login_tag.rb b/lib/sso_login_box/login_tag.rb index a17c796..2a130fb 100644 --- a/lib/sso_login_box/login_tag.rb +++ b/lib/sso_login_box/login_tag.rb @@ -1,6 +1,7 @@ module SsoLoginBox::LoginTag def self.show url_for_sso = File.read("#{ENV['PWD']}/sso_url.txt").force_encoding('utf-8').gsub(/\n/,'') - "
" + "" end end