diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index dedb3d0b..bded1cb3 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -29,7 +29,6 @@ class ApplicationController < ActionController::Base end end - def site_restart Resque.enqueue(RestartServer) end diff --git a/app/controllers/basic_infos_controller.rb b/app/controllers/basic_infos_controller.rb index 2d91bfc7..8386e13d 100644 --- a/app/controllers/basic_infos_controller.rb +++ b/app/controllers/basic_infos_controller.rb @@ -28,7 +28,7 @@ class BasicInfosController < ApplicationController def role_update user = User.find(params[:id]) if user.update_attributes(params[:user]) - redirect_to root_path + redirect_to "/users/sign_in" else @roles = Role.where(:disabled => false) render :action => "role_page" diff --git a/app/controllers/facebook_controller.rb b/app/controllers/facebook_controller.rb index 9dc7c581..c2cc4d03 100644 --- a/app/controllers/facebook_controller.rb +++ b/app/controllers/facebook_controller.rb @@ -60,14 +60,25 @@ class FacebookController< ApplicationController if data["success"] user = JSON.parse(data["user"]) u = User.find(current_user.id) - u.first_name = user["first_name"] - u.last_name = user["last_name"] + firstname = {} + lastname = {} + @site_valid_locales.each do |locale| + firstname[locale] = user["first_name"] + lastname[locale] = user["last_name"] + end + u.first_name_translations = firstname + u.last_name_translations = lastname u.office_tel = user["phone"] u.email = user["email"] + # u.email = "xyz@zyx.com" u.sex = user["gender"] || "unknown" u.remote_avatar_url = user["picture"] if user["picture"] - u.save! - render :json=>{"success"=>true,"user"=>user}.to_json + if u.save + render :json=>{"success"=>true,"user"=>user}.to_json + else + render :json=>{"success"=>false,"message"=>"Email already occupied."}.to_json + end + else render :json=>{"success"=>false,"message"=>data["message"]}.to_json end diff --git a/app/views/admin/users_new_interface/_user_for_listing.html.erb b/app/views/admin/users_new_interface/_user_for_listing.html.erb index 987d1b57..d77bf738 100644 --- a/app/views/admin/users_new_interface/_user_for_listing.html.erb +++ b/app/views/admin/users_new_interface/_user_for_listing.html.erb @@ -16,7 +16,7 @@ <% end %> - <%= link_to user_for_listing.name,admin_users_new_interface_path(user_for_listing) %> + <%= link_to (user_for_listing.name ? user_for_listing.name : user_for_listing.user_id),admin_users_new_interface_path(user_for_listing) %>
-

<%= link_to user_for_summary.name,admin_users_new_interface_path(user_for_summary)%>

+

<%= link_to (user_for_summary.name ? user_for_summary.name : user_for_summary.user_id),admin_users_new_interface_path(user_for_summary)%>

<%= user_for_summary.email%>

<%= image_tag(user_for_thumbnail.avatar) %> -

<%= link_to user_for_thumbnail.name,admin_users_new_interface_path(user_for_thumbnail)%>

+

<%= link_to (user_for_thumbnail.name ? user_for_thumbnail.name : user_for_thumbnail.user_id),admin_users_new_interface_path(user_for_thumbnail)%>

\ No newline at end of file diff --git a/app/views/basic_infos/index.html.erb b/app/views/basic_infos/index.html.erb index 8df10bcc..30af97a5 100644 --- a/app/views/basic_infos/index.html.erb +++ b/app/views/basic_infos/index.html.erb @@ -28,7 +28,7 @@ timeInterval = setInterval(function(){ if( facebookWindow.closed ){ clearInterval(timeInterval); - $(".msg").removeClass('hide').find("h4").text("Importing,please wait..."); + $(".msg").removeClass('hide alert-danger').find("h4").text("Importing,please wait..."); $.ajax({ url : "/facebook/profile_import", data : {"user_id":"<%= @user.id.to_s %>"}, diff --git a/sftp-config.json b/sftp-config.json index f489bec4..0e0efa6c 100644 --- a/sftp-config.json +++ b/sftp-config.json @@ -6,7 +6,7 @@ "type": "sftp", "save_before_upload": true, - "upload_on_save": false, + "upload_on_save": true, "sync_down_on_open": false, "sync_skip_deletes": false, "confirm_downloads": false,