Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: cimav/somos
base: 7b2b563c64
...
head fork: cimav/somos
compare: 7065d67279
  • 3 commits
  • 15 files changed
  • 0 commit comments
  • 1 contributor
View
3  app/assets/javascripts/login.js.coffee
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
View
3  app/assets/stylesheets/login.css.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the Login controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
View
4 app/controllers/home_controller.rb
@@ -8,4 +8,8 @@ def index
end
end
+ def loggedout
+ render :layout => false
+ end
+
end
View
5 app/controllers/login_controller.rb
@@ -0,0 +1,5 @@
+class LoginController < ApplicationController
+ def index
+ render :layout => false
+ end
+end
View
6 app/controllers/sessions_controller.rb
@@ -11,10 +11,8 @@ def create
end
def destroy
- session[:user_id] = nil
- session[:user_email] = nil
- session[:user_auth] = nil
- redirect_to root_url
+ reset_session
+ redirect_to '/login'
end
def failure
View
4 app/controllers/users_controller.rb
@@ -16,8 +16,4 @@ def menu
render :layout => false
end
- def logout
- render :inline => "FIXME: Implement Me"
- end
-
end
View
2  app/helpers/login_helper.rb
@@ -0,0 +1,2 @@
+module LoginHelper
+end
View
22 app/helpers/profile_picture_helper.rb
@@ -1,22 +0,0 @@
-require 'google_util'
-require 'base64'
-
-module ProfilePictureHelper
- def profile_picture(email)
- #TODO: Implement some kind of cache
- oauth_consumer = OAuth::Consumer.new(GAPPS_CONSUMER_KEY, GAPPS_CONSUMER_SECRET)
- access_token = OAuth::AccessToken.new(oauth_consumer)
- client = Google::Client.new(access_token, '2.0')
- username = email.split('@'+GAPPS_DOMAIN)[0]
- url = "https://www.google.com/m8/feeds/photos/profile/#{GAPPS_DOMAIN}/#{username}"
- img = client.get(url, {
- 'xoauth_requestor_id' => GAPPS_REQUESTOR_ID
- }, false)
- if img.nil?
- "/images/default_picture.jpg"
- else
- b64 = Base64.encode64(img)
- "data:image/gif;base64,#{b64}"
- end
- end
-end
View
2  app/views/login/index.html.haml
@@ -0,0 +1,2 @@
+%h1 Login
+%p Needs to be implemented
View
2  app/views/users/menu.html.haml
@@ -5,5 +5,5 @@
= image_tag "down-arrow.png", :id => "user-arrow"
#user-nav
%ul.user-menu
- %li= link_to (t :logout), "/u/logout"
+ %li= link_to (t :logout), "/logout"
View
5 config/initializers/omniauth.rb
@@ -1,8 +1,5 @@
#require 'openid/store/filesystem'
Rails.application.config.middleware.use OmniAuth::Builder do
- puts ENV['GOOGLE_KEY']
- puts "Chido"
- puts ENV.inspect
- provider :google_oauth2, ENV['GOOGLE_KEY'], ENV['GOOGLE_SECRET'], {approval_prompt: ''}
+ provider :google_oauth2, ENV['GOOGLE_KEY'], ENV['GOOGLE_SECRET']
end
View
8 config/routes.rb
@@ -28,7 +28,6 @@
match 'users/upcoming_birthdays' => 'users#upcoming_birthdays'
match 'u/menu' => 'users#menu'
- match 'u/logout' => 'users#logout'
resources :users
resources :pages
@@ -38,9 +37,10 @@
match 'events/upcoming' => 'post_events#upcoming'
- match '/auth/:provider/callback', to: 'sessions#create'
- match '/auth/failure', :to => 'sessions#failure'
- match "/logout", to: "sessions#destroy", :as => "logout"
+ match '/auth/:provider/callback' => 'sessions#create'
+ match '/auth/failure' => 'sessions#failure'
+ match "/logout" => 'sessions#destroy'
+ match '/login' => 'login#index'
match 'editor/link_dialog' => 'editor#link_dialog'
View
47 lib/google_util.rb
@@ -1,47 +0,0 @@
-require 'oauth'
-require 'rexml/document'
-
-# Simple helper around the ruby oauth library for making Google Data API requests
-module Google
- class Client
- attr_accessor :oauth_token
- attr_accessor :version
-
- def initialize(token, version = '1.0')
- @token = token
- @version = version
- end
-
- def get(base, query_parameters, parse = true)
- make_request(:get, url(base, query_parameters), parse)
- end
-
- def make_request(method, url, parse = true)
- response = @token.request(method, url, { 'GData-Version' => version })
- if response.is_a?(Net::HTTPFound)
- url = response['Location']
- return make_request(method, response['Location'])
- end
- return unless response.is_a?(Net::HTTPSuccess)
- if parse
- REXML::Document.new(response.body)
- else
- response.body
- end
- end
-
- private
-
- def url(base, query_parameters={})
- url = base
- unless query_parameters.empty?
- url += '?'
- query_parameters.each { |key, value|
- url += "#{CGI::escape(key)}=#{CGI::escape(value)}&"
- }
- url.chop!
- end
- url
- end
- end
-end
View
7 test/functional/login_controller_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class LoginControllerTest < ActionController::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
View
4 test/unit/helpers/login_helper_test.rb
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class LoginHelperTest < ActionView::TestCase
+end

No commit comments for this range

Something went wrong with that request. Please try again.