bcms_pubcookie 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bcms_pubcookie.gemspec +1 -1
- data/lib/pubcookie/railtie.rb +2 -0
- data/lib/pubcookie/user_extensions.rb +11 -0
- data/lib/pubcookie/users_controller.rb +41 -0
- metadata +7 -6
data/bcms_pubcookie.gemspec
CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "bcms_pubcookie"
|
6
|
-
s.version = "0.3.
|
6
|
+
s.version = "0.3.2"
|
7
7
|
s.authors = ["James Hughes"]
|
8
8
|
s.email = ["james@virtualjames.com"]
|
9
9
|
s.homepage = "http://github.com/jamezilla/bcms_pubcookie"
|
data/lib/pubcookie/railtie.rb
CHANGED
@@ -4,6 +4,7 @@ require 'bcms_pubcookie'
|
|
4
4
|
require 'pubcookie/user_extensions'
|
5
5
|
require 'pubcookie/authentication/controller'
|
6
6
|
require 'pubcookie/sessions_controller'
|
7
|
+
require 'pubcookie/users_controller'
|
7
8
|
|
8
9
|
module Pubcookie
|
9
10
|
class Railtie < ::Rails::Railtie
|
@@ -12,6 +13,7 @@ module Pubcookie
|
|
12
13
|
User.send(:include, Pubcookie::UserExtensions)
|
13
14
|
Cms::Authentication::Controller.send(:include, Pubcookie::Authentication::Controller)
|
14
15
|
Cms::SessionsController.send(:include, Pubcookie::SessionsController)
|
16
|
+
Cms::UsersController.send(:include, Pubcookie::UsersController)
|
15
17
|
end
|
16
18
|
|
17
19
|
end
|
@@ -4,6 +4,17 @@ module Pubcookie
|
|
4
4
|
# Called when this module is included on the given class.
|
5
5
|
def self.included(base)
|
6
6
|
base.extend(ClassMethods)
|
7
|
+
base.send(:include, InstanceMethods)
|
8
|
+
end
|
9
|
+
|
10
|
+
module InstanceMethods
|
11
|
+
|
12
|
+
def set_fake_password!
|
13
|
+
fake_password = self.class.make_token
|
14
|
+
self.password = fake_password
|
15
|
+
self.password_confirmation = fake_password
|
16
|
+
end
|
17
|
+
|
7
18
|
end
|
8
19
|
|
9
20
|
module ClassMethods
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Pubcookie
|
2
|
+
|
3
|
+
# Extends the core UsersController to prepend view paths
|
4
|
+
module UsersController
|
5
|
+
|
6
|
+
def self.included(controller_class)
|
7
|
+
controller_class.send(:include, InstanceMethods)
|
8
|
+
controller_class.before_filter(:add_view_paths)
|
9
|
+
controller_class.alias_method_chain(:create, :pubcookie)
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
module InstanceMethods
|
14
|
+
|
15
|
+
def create_with_pubcookie
|
16
|
+
@object = build_object(params[variable_name])
|
17
|
+
@object.set_fake_password!
|
18
|
+
|
19
|
+
if @object.save
|
20
|
+
flash[:notice] = "User '#{ @object.first_name} #{ @object.last_name}' was created"
|
21
|
+
redirect_to after_create_url
|
22
|
+
else
|
23
|
+
if (params[:on_fail_action])
|
24
|
+
render :action => params[:on_fail_action]
|
25
|
+
else
|
26
|
+
render :action => 'new'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def add_view_paths
|
34
|
+
prepend_view_path(File.join(__FILE__, "..", "..", "..", "app", "views"))
|
35
|
+
# logger.debug view_paths.inspect.to_s
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bcms_pubcookie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-12-30 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &2152288120 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '3.0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2152288120
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: browsercms
|
27
|
-
requirement: &
|
27
|
+
requirement: &2152286940 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '3.3'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2152286940
|
36
36
|
description:
|
37
37
|
email:
|
38
38
|
- james@virtualjames.com
|
@@ -54,6 +54,7 @@ files:
|
|
54
54
|
- lib/pubcookie/railtie.rb
|
55
55
|
- lib/pubcookie/sessions_controller.rb
|
56
56
|
- lib/pubcookie/user_extensions.rb
|
57
|
+
- lib/pubcookie/users_controller.rb
|
57
58
|
- lib/tasks/.gitkeep
|
58
59
|
homepage: http://github.com/jamezilla/bcms_pubcookie
|
59
60
|
licenses: []
|