From 752a525778c3ebe2647cd8ea35deb18a99bbece7 Mon Sep 17 00:00:00 2001 From: spen Date: Thu, 15 May 2014 11:54:39 +0800 Subject: [PATCH] fix login and announcement frontend field --- app/controllers/sessions_controller.rb | 40 ++------------------------ built_in_extensions.rb | 2 +- 2 files changed, 4 insertions(+), 38 deletions(-) diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 6035116..a1e6c08 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -61,44 +61,10 @@ class SessionsController < Devise::SessionsController sign_in(resource_name, resource) redirect_to after_sign_in_path_for(resource) - else #認證通過無帳號要新增 + else #認證通過無帳號不通過 - @new_user = User.new - - @new_user.user_id = @LDAP_USER - @new_user.admin = false - @new_user.email = "#{@LDAP_USER}@ydu.edu.tw" - @new_user.password = "#{@LDAP_USER}@ydu.edu.tw" - @new_user.created_at = DateTime.now - @new_user.updated_at = DateTime.now - - @new_user.cache_dept = { "zh_tw" => ( @datas[1] ? @datas[1] : nil ), "en" => ( @datas[1] ? @datas[1] : nil ) } - - @new_user.first_name_translations = {} - - @new_user.first_name_translations["zh_tw"] = ( @datas[1] ? @datas[1] : nil ) - - @new_user.first_name_translations["en"] = ( @datas[1] ? @datas[1] : nil ) - - # @new_user.first_name = ( @datas[1] ? @datas[1] : nil ) - - if @datas[0] == 'P' - - @new_user.last_name_translations = {} - - @new_user.last_name_translations["zh_tw"] = ( @datas[2] ? @datas[2] : nil ) - - @new_user.last_name_translations["en"] = ( @datas[2] ? @datas[2] : nil ) - - # @new_user.last_name = ( @datas[2] ? @datas[2] : nil ) - - end - - @new_user.save - - resource_name = @new_user.class.to_s.downcase - sign_in(resource_name, @new_user) - redirect_to after_sign_in_path_for(@new_user) + flash[:error] = "很抱歉,您無此權限或帳號登入本站,請洽本站管理員
Sorry, you don't have the account or authority to login. Please contact the website administrator." + redirect_to :root end diff --git a/built_in_extensions.rb b/built_in_extensions.rb index 2e13080..83ac2d1 100644 --- a/built_in_extensions.rb +++ b/built_in_extensions.rb @@ -1,6 +1,6 @@ #built-in-modules gem 'archive', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-archive.git' -gem 'announcement', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-announcement.git' +gem 'announcement', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-announcement.git', :branch => 'ydu' gem 'gallery', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-gallery.git' gem 'member', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-member.git' gem 'member_staff', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-memberstaff.git'