diff --git a/Gemfile b/Gemfile index d1afdb8c..11a9dc2e 100644 --- a/Gemfile +++ b/Gemfile @@ -25,6 +25,7 @@ gem 'sinatra' gem 'sprockets' gem 'tinymce-rails' gem 'therubyracer' if RUBY_PLATFORM.downcase.include?("linux") +gem 'mongoid-encryptor', :require => 'mongoid/encryptor' # Gems used only for assets and not required # in production environments by default. diff --git a/Gemfile.lock b/Gemfile.lock index 71742974..339bae0f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -77,6 +77,7 @@ GEM orm_adapter (~> 0.0.3) warden (~> 1.1) diff-lcs (1.1.3) + encrypted_strings (0.3.3) erubis (2.7.0) exception_notification (2.5.2) actionmailer (>= 3.0.4) @@ -115,6 +116,10 @@ GEM activemodel (~> 3.1) mongo (~> 1.3) tzinfo (~> 0.3.22) + mongoid-encryptor (0.0.5) + activesupport (~> 3.0) + encrypted_strings (~> 0.3.3) + mongoid (~> 2) multi_json (1.1.0) nokogiri (1.5.2) nokogiri (1.5.2-x86-mingw32) @@ -255,6 +260,7 @@ DEPENDENCIES mini_magick mongo_session_store-rails3 mongoid + mongoid-encryptor nokogiri radius rails (>= 3.1.0, < 3.2.0) diff --git a/app/assets/javascripts/orbitdesktop.js b/app/assets/javascripts/orbitdesktop.js index 1977fcb3..11f9e132 100755 --- a/app/assets/javascripts/orbitdesktop.js +++ b/app/assets/javascripts/orbitdesktop.js @@ -136,8 +136,10 @@ var orbitDesktop = function(dom){ o.currentface = "home"; var bindHandlers = function(){ // this function will bind all the handlers in the desktop + var groupWrapperWidth = 0; $("div#desktop .group").each(function(){groupWrapperWidth+=$(this).outerWidth(true);}); + $("div#desktop #group_wrapper").css("width",groupWrapperWidth); $("div#desktop .g_col").sortable({ connectWith: ".g_col", diff --git a/app/controllers/otheraccounts_controller.rb b/app/controllers/otheraccounts_controller.rb index f5051cb8..2f76c905 100644 --- a/app/controllers/otheraccounts_controller.rb +++ b/app/controllers/otheraccounts_controller.rb @@ -9,13 +9,19 @@ class OtheraccountsController< ApplicationController @email = params['email'] @password = params['password'] @account = params['account'] - OtherAccount.new(email: @email, encrypted_password: @password, type: @account) + OtherAccount.create(user_id: current_user.id, email: @email, encrypted_password: @password, type: @account) + a = Array.new + a << {"success"=>"true"} + render :json=>a.to_json end def gmail + @gmailaccount = OtherAccount.where(:type.all => ["gmail"],:user_id.all => [current_user.id]) + @decrypted_password = @gmailaccount.first.encrypted_password.decrypt + @email = @gmailaccount.first.email url = URI.parse("https://mail.google.com/mail/feed/atom") req = Net::HTTP::Get.new(url.path) - req.basic_auth params['username'], params['password'] + req.basic_auth @email, @decrypted_password req.content_type = 'text/xml' http = Net::HTTP.new(url.host, url.port) diff --git a/app/models/other_account.rb b/app/models/other_account.rb index 59f5a1de..2b660666 100644 --- a/app/models/other_account.rb +++ b/app/models/other_account.rb @@ -1,15 +1,15 @@ class OtherAccount include Mongoid::Document include Mongoid::Timestamps + include Mongoid::Encryptor + field :user_id field :type field :email field :encrypted_password - #attr_encrypted :encrypted_password, :key => 'rulingorbit.com', :encode => true + encrypts :encrypted_password, :mode => :symmetric, :password => 'rulingcom' belongs_to :user - - end \ No newline at end of file diff --git a/app/views/desktop/settings/connections.html.erb b/app/views/desktop/settings/connections.html.erb index cac2acd7..44a4e044 100644 --- a/app/views/desktop/settings/connections.html.erb +++ b/app/views/desktop/settings/connections.html.erb @@ -10,7 +10,8 @@
- | |
- | |
Check for new mail | -