mbleigh-twitter-auth 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +1 -1
- data/generators/{twitter_auth_migration → twitter_auth}/templates/migration.rb +10 -0
- data/generators/twitter_auth/templates/user.rb +7 -0
- data/generators/twitter_auth/twitter_auth_generator.rb +10 -0
- data/lib/twitter_auth/controller_extensions.rb +1 -1
- data/lib/twitter_auth/cryptify.rb +3 -12
- metadata +7 -8
- data/generators/twitter_auth_migration/twitter_auth_migration_generator.rb +0 -7
- data/test/test_helper.rb +0 -10
- data/test/twitter_auth_test.rb +0 -7
data/VERSION.yml
CHANGED
@@ -13,6 +13,16 @@ class TwitterAuthMigration < ActiveRecord::Migration
|
|
13
13
|
t.string :profile_image_url
|
14
14
|
t.string :url
|
15
15
|
t.boolean :protected
|
16
|
+
t.string :profile_background_color
|
17
|
+
t.string :profile_sidebar_fill_color
|
18
|
+
t.string :profile_link_color
|
19
|
+
t.string :profile_sidebar_border_color
|
20
|
+
t.string :profile_text_color
|
21
|
+
t.integer :friends_count
|
22
|
+
t.integer :statuses_count
|
23
|
+
t.integer :followers_count
|
24
|
+
t.integer :favourites_count
|
25
|
+
t.integer :utc_offset
|
16
26
|
|
17
27
|
t.timestamps
|
18
28
|
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
class User < TwitterAuth::GenericUser
|
2
|
+
# Because Rails 2.3 does not allow for simple
|
3
|
+
# overriding of an Engine class from a samely
|
4
|
+
# named model in the app, this is instead
|
5
|
+
# inheriting from a GenericUser class that
|
6
|
+
# already utilizes the 'users' table.
|
7
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
class TwitterAuthGenerator < Rails::Generator::Base
|
2
|
+
def manifest
|
3
|
+
record do |m|
|
4
|
+
m.class_collisions 'User'
|
5
|
+
|
6
|
+
m.migration_template 'migration.rb', 'db/migrate', :migration_file_name => "twitter_auth_migration"
|
7
|
+
m.template 'user.rb', File.join('app/models', 'user.rb')
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -91,7 +91,7 @@ module TwitterAuth
|
|
91
91
|
# after_filter :store_location, :only => [:index, :new, :show, :edit]
|
92
92
|
# for any controller you want to be bounce-backable.
|
93
93
|
def redirect_back_or_default(default=nil)
|
94
|
-
redirect_to(session[:return_to] || default || default_location)
|
94
|
+
redirect_to(session[:return_to] || default || self.default_location)
|
95
95
|
session[:return_to] = nil
|
96
96
|
end
|
97
97
|
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'openssl'
|
2
1
|
module TwitterAuth
|
3
2
|
module Cryptify
|
4
3
|
class Error < StandardError; end
|
@@ -6,23 +5,15 @@ module TwitterAuth
|
|
6
5
|
@@crypt_password = '--TwitterAuth-!##@--2ef'
|
7
6
|
|
8
7
|
def self.encrypt(data, salt)
|
9
|
-
|
10
|
-
cipher.encrypt
|
11
|
-
cipher.pkcs5_keyivgen(crypt_password, salt)
|
12
|
-
encrypted_data = cipher.update(data)
|
13
|
-
encrypted_data << cipher.final
|
8
|
+
EzCrypto::Key.encrypt_with_password(crypt_password, salt, data)
|
14
9
|
end
|
15
10
|
|
16
11
|
def self.decrypt(encrypted_data, salt)
|
17
|
-
|
18
|
-
cipher.decrypt
|
19
|
-
cipher.pkcs5_keyivgen(crypt_password, salt)
|
20
|
-
data = cipher.update(encrypted_data)
|
21
|
-
data << cipher.final
|
12
|
+
EzCrypto::Key.decrypt_with_password(crypt_password, salt, encrypted_data)
|
22
13
|
end
|
23
14
|
|
24
15
|
def self.generate_salt
|
25
|
-
|
16
|
+
ActiveSupport::SecureRandom.hex(4)
|
26
17
|
end
|
27
18
|
end
|
28
19
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mbleigh-twitter-auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Bleigh
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-02-
|
12
|
+
date: 2009-02-07 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -24,16 +24,15 @@ extra_rdoc_files: []
|
|
24
24
|
files:
|
25
25
|
- README.markdown
|
26
26
|
- VERSION.yml
|
27
|
-
- generators/
|
28
|
-
- generators/
|
29
|
-
- generators/
|
30
|
-
- generators/
|
27
|
+
- generators/twitter_auth
|
28
|
+
- generators/twitter_auth/templates
|
29
|
+
- generators/twitter_auth/templates/migration.rb
|
30
|
+
- generators/twitter_auth/templates/user.rb
|
31
|
+
- generators/twitter_auth/twitter_auth_generator.rb
|
31
32
|
- lib/twitter_auth
|
32
33
|
- lib/twitter_auth/controller_extensions.rb
|
33
34
|
- lib/twitter_auth/cryptify.rb
|
34
35
|
- lib/twitter_auth.rb
|
35
|
-
- test/test_helper.rb
|
36
|
-
- test/twitter_auth_test.rb
|
37
36
|
- spec/spec_helper.rb
|
38
37
|
- spec/twitter_auth_spec.rb
|
39
38
|
has_rdoc: true
|
data/test/test_helper.rb
DELETED
data/test/twitter_auth_test.rb
DELETED