Compare commits
8 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
f9fd25c29d | |
|
|
2761fe06b6 | |
|
|
3b0584e30d | |
|
|
d65a6abbe8 | |
|
|
752a525778 | |
|
|
2ea19aa230 | |
|
|
0db4afe643 | |
|
|
e591499de5 |
2
Gemfile
2
Gemfile
|
|
@ -1,6 +1,8 @@
|
||||||
source 'http://rubygems.org'
|
source 'http://rubygems.org'
|
||||||
gem 'rails', "~> 3.2.16"
|
gem 'rails', "~> 3.2.16"
|
||||||
|
|
||||||
|
gem 'savon', '~> 2.2.0'
|
||||||
|
|
||||||
gem "brakeman"
|
gem "brakeman"
|
||||||
gem 'mime-types'
|
gem 'mime-types'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@ $(function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
// Initialize the jQuery File Upload widget:
|
// Initialize the jQuery File Upload widget:
|
||||||
$('#fileupload').fileupload({
|
$('#fileupload').fileupload({
|
||||||
maxFileSize: 50000000000,
|
maxFileSize: 5000000,
|
||||||
acceptFileTypes: /(\.|\/)(gif|jpe?g|png|pdf|doc|docx|ppt|pptx|xls|xlsx|csv|txt|zip|rar|tar|gz|odt|tiff|key|page)$/i,
|
acceptFileTypes: /(\.|\/)(gif|jpe?g|png|pdf|doc|docx|ppt|pptx|xls|xlsx)$/i,
|
||||||
dropZone: $('#dropzone'),
|
dropZone: $('#dropzone'),
|
||||||
headers:{
|
headers:{
|
||||||
'X-CSRF-Token': $('meta[name="csrf-token"]').attr("content")
|
'X-CSRF-Token': $('meta[name="csrf-token"]').attr("content")
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,7 @@ class Admin::DashboardsController < OrbitBackendController
|
||||||
a = {}
|
a = {}
|
||||||
total = 0
|
total = 0
|
||||||
args.each do |module_app|
|
args.each do |module_app|
|
||||||
|
next if !Object.const_defined?(module_app.classify)
|
||||||
module_app_class = module_app.classify.constantize
|
module_app_class = module_app.classify.constantize
|
||||||
count = module_app_class.count
|
count = module_app_class.count
|
||||||
a.merge!(module_app => count)
|
a.merge!(module_app => count)
|
||||||
|
|
@ -76,6 +77,7 @@ class Admin::DashboardsController < OrbitBackendController
|
||||||
def get_recently_updated(*args)
|
def get_recently_updated(*args)
|
||||||
a = {}
|
a = {}
|
||||||
args.each do |module_app|
|
args.each do |module_app|
|
||||||
|
next if !Object.const_defined?(module_app.classify)
|
||||||
module_app_class = module_app.classify.constantize
|
module_app_class = module_app.classify.constantize
|
||||||
objects = module_app_class.order_by(:updated_at, :desc).limit(20)
|
objects = module_app_class.order_by(:updated_at, :desc).limit(20)
|
||||||
objects.each do |object|
|
objects.each do |object|
|
||||||
|
|
@ -90,6 +92,7 @@ class Admin::DashboardsController < OrbitBackendController
|
||||||
def get_most_visited(*args)
|
def get_most_visited(*args)
|
||||||
a = {}
|
a = {}
|
||||||
args.each do |module_app|
|
args.each do |module_app|
|
||||||
|
next if !Object.const_defined?(module_app.classify)
|
||||||
module_app_class = module_app.classify.constantize
|
module_app_class = module_app.classify.constantize
|
||||||
objects = module_app_class.order_by(:view_count, :desc).limit(20)
|
objects = module_app_class.order_by(:view_count, :desc).limit(20)
|
||||||
objects.each do |object|
|
objects.each do |object|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,82 @@
|
||||||
|
# encoding: utf-8
|
||||||
|
|
||||||
|
class SessionsController < Devise::SessionsController
|
||||||
|
prepend_before_filter :require_no_authentication, :only => [ :new, :create ]
|
||||||
|
|
||||||
|
require 'savon'
|
||||||
|
|
||||||
|
def create
|
||||||
|
|
||||||
|
|
||||||
|
@SYS_USER = "rulingcom"
|
||||||
|
@SYS_PASS = "pxm87912tkx"
|
||||||
|
@LDAP_USER = params[:user][:user_id]
|
||||||
|
@LDAP_PASS = params[:user][:password]
|
||||||
|
|
||||||
|
if @LDAP_USER == 'rulingcom'
|
||||||
|
|
||||||
|
resource = User.first(conditions:{user_id: @LDAP_USER})
|
||||||
|
|
||||||
|
if !resource.blank? and resource.valid_password?(@LDAP_PASS)
|
||||||
|
|
||||||
|
resource_name = resource.class.to_s.downcase
|
||||||
|
sign_in(resource_name, resource)
|
||||||
|
redirect_to after_sign_in_path_for(resource)
|
||||||
|
|
||||||
|
elsif !resource.valid_password?(@LDAP_PASS)
|
||||||
|
|
||||||
|
flash[:error] = "密碼錯誤<br />password Local fail"
|
||||||
|
redirect_to :root
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
flash[:error] = "很抱歉,您無此權限或帳號登入本站,請洽本站管理員<br />Sorry, you don't have the account or authority to login. Please contact the website administrator."
|
||||||
|
redirect_to :root
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
client = Savon.client(wsdl: 'http://ap.ydu.edu.tw/LDAP_WS/RulingcomDataService.asmx?wsdl',filters: [:SYS_USER, :SYS_PASS, :LDAP_USER, :LDAP_PASS])
|
||||||
|
|
||||||
|
client.operations
|
||||||
|
|
||||||
|
response = client.call(:login_chk, message: {
|
||||||
|
"SYS_USER" => @SYS_USER,
|
||||||
|
"SYS_PASS" => @SYS_PASS,
|
||||||
|
"LDAP_USER" => @LDAP_USER,
|
||||||
|
"LDAP_PASS" => @LDAP_PASS,
|
||||||
|
"User_IP" => request.remote_ip
|
||||||
|
})
|
||||||
|
|
||||||
|
@datas = response.body[:login_chk_response][:login_chk_result][:string]
|
||||||
|
|
||||||
|
if !@datas[0].blank? and ( @datas[0] == 'P' or @datas[0] == 'U' ) #使用者帳號回傳P,單位帳號回傳U
|
||||||
|
|
||||||
|
resource = User.first(conditions:{user_id: @LDAP_USER})
|
||||||
|
|
||||||
|
if !resource.blank?
|
||||||
|
|
||||||
|
resource_name = resource.class.to_s.downcase
|
||||||
|
sign_in(resource_name, resource)
|
||||||
|
redirect_to after_sign_in_path_for(resource)
|
||||||
|
|
||||||
|
else #認證通過無帳號不通過
|
||||||
|
|
||||||
|
flash[:error] = "很抱歉,您無此權限或帳號登入本站,請洽本站管理員<br />Sorry, you don't have the account or authority to login. Please contact the website administrator."
|
||||||
|
redirect_to :root
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
else
|
||||||
|
flash[:error] = "很抱歉,您無此權限或帳號登入本站,請洽本站管理員<br />Sorry, you don't have the account or authority to login. Please contact the website administrator."
|
||||||
|
redirect_to :root
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
@ -63,6 +63,7 @@ class MailCronMailer < ActionMailer::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@mail_cron_log = {
|
@mail_cron_log = {
|
||||||
:mail_subject => @data.mail_subject,
|
:mail_subject => @data.mail_subject,
|
||||||
:mail_to => group_mail,
|
:mail_to => group_mail,
|
||||||
|
|
@ -73,16 +74,10 @@ class MailCronMailer < ActionMailer::Base
|
||||||
|
|
||||||
@mail_cron_log = MailCronLog.new(@mail_cron_log)
|
@mail_cron_log = MailCronLog.new(@mail_cron_log)
|
||||||
|
|
||||||
|
|
||||||
@mail_cron_log.save
|
@mail_cron_log.save
|
||||||
|
|
||||||
@mail_to_count = @data.mail_to.split(',') - group_mail.split(',')
|
@data.destroy
|
||||||
|
|
||||||
if @mail_to_count.count == 0
|
|
||||||
@data.destroy
|
|
||||||
else
|
|
||||||
@data.mail_to = @mail_to_count.join(',')
|
|
||||||
@data.save
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ class MailCron
|
||||||
|
|
||||||
if !email_user_id.blank?
|
if !email_user_id.blank?
|
||||||
|
|
||||||
@user = User.find(email_user_id) rescue nil
|
@user = User.find(email_user_id)
|
||||||
|
|
||||||
@group_mail << @user.email if !@user.blank?
|
@group_mail << @user.email if !@user.blank?
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ class User
|
||||||
|
|
||||||
validates :user_id,
|
validates :user_id,
|
||||||
:presence => { :message => I18n.t("users.user_id_not_null") } ,
|
:presence => { :message => I18n.t("users.user_id_not_null") } ,
|
||||||
:length => {:minimum => 3, :maximum => 50, :message => I18n.t("users.user_id_length") },
|
:length => {:minimum => 2, :maximum => 50, :message => I18n.t("users.user_id_length") },
|
||||||
:uniqueness => true
|
:uniqueness => true
|
||||||
|
|
||||||
scope :approval_pending, where(:approved => false)
|
scope :approval_pending, where(:approved => false)
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,9 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</h1>
|
</h1>
|
||||||
<i class="openmenu icons-arrow-down-5"></i>
|
<i class="openmenu icons-arrow-down-5"></i>
|
||||||
|
<!--
|
||||||
<%= link_to mobile_dialog_language_path(:app => params[:app]), {:class => "ui-btn-right language", "data-iconpos" => "notext", "data-icon" => "search", "data-rel" => "dialog"} do %>
|
<%= link_to mobile_dialog_language_path(:app => params[:app]), {:class => "ui-btn-right language", "data-iconpos" => "notext", "data-icon" => "search", "data-rel" => "dialog"} do %>
|
||||||
<i class="icons-earth"></i>
|
<i class="icons-earth"></i>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
-->
|
||||||
</header>
|
</header>
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#built-in-modules
|
#built-in-modules
|
||||||
gem 'archive', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-archive.git'
|
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 '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', '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'
|
gem 'member_staff', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-memberstaff.git'
|
||||||
|
|
@ -15,4 +15,4 @@ gem 'personal_lab', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-
|
||||||
gem 'personal_patent', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-personalpatent.git'
|
gem 'personal_patent', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-personalpatent.git'
|
||||||
gem 'personal_project', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-personalproject.git'
|
gem 'personal_project', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-personalproject.git'
|
||||||
gem 'personal_research', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-personalresearch.git'
|
gem 'personal_research', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-personalresearch.git'
|
||||||
gem 'web_resource', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-webresource.git'
|
gem 'web_resource', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-webresource.git'
|
||||||
|
|
|
||||||
|
|
@ -600,7 +600,7 @@ en:
|
||||||
user_id: User Account
|
user_id: User Account
|
||||||
user_id_note: Should be more than 3 characters and less than 50 characters
|
user_id_note: Should be more than 3 characters and less than 50 characters
|
||||||
user_id_not_null: User account cannot be null
|
user_id_not_null: User account cannot be null
|
||||||
user_id_length: User account should be more than 3 characters
|
user_id_length: User account should be more than 2 characters
|
||||||
user_id_error: Someone already use that user account
|
user_id_error: Someone already use that user account
|
||||||
user_basic_id_form: Account Info.
|
user_basic_id_form: Account Info.
|
||||||
user_basic_data: Personal Profile
|
user_basic_data: Personal Profile
|
||||||
|
|
|
||||||
|
|
@ -600,7 +600,7 @@ zh_tw:
|
||||||
user_id: 使用者帳號
|
user_id: 使用者帳號
|
||||||
user_id_note: 需介於3個字元至50個字元之間
|
user_id_note: 需介於3個字元至50個字元之間
|
||||||
user_id_not_null: 使用者帳號不能是空值
|
user_id_not_null: 使用者帳號不能是空值
|
||||||
user_id_length: 使用者帳號至少需要3個字元
|
user_id_length: 使用者帳號至少需要2個字元
|
||||||
user_id_error: 該使用者帳號已被使用
|
user_id_error: 該使用者帳號已被使用
|
||||||
user_basic_id_form: 帳號資料
|
user_basic_id_form: 帳號資料
|
||||||
user_basic_data: 個人資料
|
user_basic_data: 個人資料
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ Orbit::Application.routes.draw do
|
||||||
|
|
||||||
# get "robots.txt" => 'robots#index'
|
# get "robots.txt" => 'robots#index'
|
||||||
|
|
||||||
devise_for :users, :controllers => { :registrations => "registrations", :passwords => 'passwords', :confirmations => 'confirmations' } do
|
devise_for :users, :controllers => {:sessions => 'sessions', :registrations => "registrations", :passwords => 'passwords', :confirmations => 'confirmations' } do
|
||||||
resources :passwords, :except => [:index, :show, :destroy]
|
resources :passwords, :except => [:index, :show, :destroy]
|
||||||
match "/users_passwd" => "desktop/registrations#update", :as => :users_passwd, :via => :put
|
match "/users_passwd" => "desktop/registrations#update", :as => :users_passwd, :via => :put
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue