spud_core 0.9.16 → 0.9.17
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/README.markdown +17 -0
- data/app/mailers/spud/core_mailer.rb +1 -1
- data/app/models/concerns/spud_authentication.rb +10 -0
- data/app/models/spud_user.rb +2 -4
- data/lib/spud_core/version.rb +1 -1
- data/spec/dummy/log/development.log +37 -15
- data/spec/dummy/log/test.log +29244 -119721
- metadata +5 -4
data/README.markdown
CHANGED
@@ -61,3 +61,20 @@ After the tests have completed the current code coverage stats is available by o
|
|
61
61
|
|
62
62
|
NOTE: Spud Core is Retina Resolution Compatible Now
|
63
63
|
|
64
|
+
Customizing Authentication
|
65
|
+
---------------------------
|
66
|
+
|
67
|
+
Authentication resides in an `ActiveSupport::Concern` module called `SpudAuthentication`. This allows you to override the base authlogic configuration or potentially swap it out for another authentication library.
|
68
|
+
|
69
|
+
To override the base authentication, create a file at `models/concerns/spud_authentication.rb`. Here is an example concern that would configure authlogic to allow users with duplicate email addresses.
|
70
|
+
|
71
|
+
module Concerns
|
72
|
+
module SpudAuthentication
|
73
|
+
extend ActiveSupport::Concern
|
74
|
+
included do
|
75
|
+
acts_as_authentic do |c|
|
76
|
+
c.validate_email_field = false
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -5,7 +5,7 @@ class Spud::CoreMailer < ActionMailer::Base
|
|
5
5
|
@user = user
|
6
6
|
@url = edit_spud_password_reset_url(:id => user.perishable_token)
|
7
7
|
# @url = "/spud/password_resets/#{user.perishable_token}/edit"
|
8
|
-
mail(:from =>Spud::Core.from_address,:to => user.email, :subject => "Forgot Password Request from Spud
|
8
|
+
mail(:from =>Spud::Core.from_address,:to => user.email, :subject => "Forgot Password Request from #{Spud::Core.config.site_name}")
|
9
9
|
|
10
10
|
end
|
11
11
|
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module Concerns
|
2
|
+
module SpudAuthentication
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
included do
|
5
|
+
acts_as_authentic do |c|
|
6
|
+
# c.my_config_option = my_value # for available options see documentation in: Authlogic::ActsAsAuthentic
|
7
|
+
end # block optional
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
data/app/models/spud_user.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
class SpudUser < ActiveRecord::Base
|
2
|
+
include Concerns::SpudAuthentication
|
3
|
+
|
2
4
|
has_many :spud_admin_permissions,:foreign_key => :user_id
|
3
5
|
has_many :spud_user_settings
|
4
6
|
accepts_nested_attributes_for :spud_admin_permissions, :allow_destroy => true
|
@@ -6,10 +8,6 @@ class SpudUser < ActiveRecord::Base
|
|
6
8
|
attr_accessible :login,:email,:first_name,:last_name,:password,:password_confirmation,:password_salt,:last_login_at,:last_request_at,:last_login_ip,:failed_login_count,:current_login_at,:login_count,:persistence_token,:perishable_token,:single_access_token,:crypted_password, :current_login_ip, :created_at, :updated_at,:spud_admin_permissions_attributes,:time_zone, :as => [:default, :admin]
|
7
9
|
attr_accessible :super_admin, :id, :as => :admin
|
8
10
|
|
9
|
-
acts_as_authentic do |c|
|
10
|
-
# c.my_config_option = my_value # for available options see documentation in: Authlogic::ActsAsAuthentic
|
11
|
-
end # block optional
|
12
|
-
|
13
11
|
def has_admin_rights?
|
14
12
|
return self.super_admin || self.spud_admin_permissions.count > 0
|
15
13
|
end
|
data/lib/spud_core/version.rb
CHANGED
@@ -1,17 +1,39 @@
|
|
1
1
|
Connecting to database specified by database.yml
|
2
|
-
[1m[36m (
|
3
|
-
[1m[35m (
|
2
|
+
[1m[36m (65.4ms)[0m [1mCREATE TABLE `schema_migrations` (`version` varchar(255) NOT NULL) ENGINE=InnoDB[0m
|
3
|
+
[1m[35m (144.1ms)[0m CREATE UNIQUE INDEX `unique_schema_migrations` ON `schema_migrations` (`version`)
|
4
|
+
[1m[36m (0.3ms)[0m [1mSELECT `schema_migrations`.`version` FROM `schema_migrations` [0m
|
5
|
+
Migrating to CreateSpudAdminPermissions (20111214161011)
|
6
|
+
[1m[35m (103.8ms)[0m CREATE TABLE `spud_admin_permissions` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `user_id` int(11), `name` varchar(255), `access` tinyint(1), `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL) ENGINE=InnoDB
|
7
|
+
[1m[36m (0.8ms)[0m [1mINSERT INTO `schema_migrations` (`version`) VALUES ('20111214161011')[0m
|
8
|
+
Migrating to CreateSpudUsers (20111214161146)
|
9
|
+
[1m[35m (113.1ms)[0m CREATE TABLE `spud_users` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `first_name` varchar(255), `last_name` varchar(255), `super_admin` tinyint(1), `login` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `crypted_password` varchar(255) NOT NULL, `password_salt` varchar(255) NOT NULL, `persistence_token` varchar(255) NOT NULL, `single_access_token` varchar(255) NOT NULL, `perishable_token` varchar(255) NOT NULL, `login_count` int(11) DEFAULT 0 NOT NULL, `failed_login_count` int(11) DEFAULT 0 NOT NULL, `last_request_at` datetime, `current_login_at` datetime, `last_login_at` datetime, `current_login_ip` varchar(255), `last_login_ip` varchar(255), `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL) ENGINE=InnoDB
|
10
|
+
[1m[36m (117.7ms)[0m [1mCREATE INDEX `index_spud_users_on_login` ON `spud_users` (`login`)[0m
|
11
|
+
[1m[35m (111.0ms)[0m CREATE INDEX `index_spud_users_on_email` ON `spud_users` (`email`)
|
12
|
+
[1m[36m (0.8ms)[0m [1mINSERT INTO `schema_migrations` (`version`) VALUES ('20111214161146')[0m
|
13
|
+
Migrating to AddTimeZoneToSpudUser (20120327124229)
|
14
|
+
[1m[35m (149.1ms)[0m ALTER TABLE `spud_users` ADD `time_zone` varchar(255)
|
15
|
+
[1m[36m (0.5ms)[0m [1mINSERT INTO `schema_migrations` (`version`) VALUES ('20120327124229')[0m
|
16
|
+
Migrating to AddScopeToSpudAdminPermissions (20120328235431)
|
17
|
+
[1m[35m (130.5ms)[0m ALTER TABLE `spud_admin_permissions` ADD `scope` varchar(255)
|
18
|
+
[1m[36m (0.5ms)[0m [1mINSERT INTO `schema_migrations` (`version`) VALUES ('20120328235431')[0m
|
19
|
+
Migrating to CreateSpudUserSettings (20120329174000)
|
20
|
+
[1m[35m (105.9ms)[0m CREATE TABLE `spud_user_settings` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `spud_user_id` int(11), `key` varchar(255), `value` varchar(255), `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL) ENGINE=InnoDB
|
21
|
+
[1m[36m (0.8ms)[0m [1mINSERT INTO `schema_migrations` (`version`) VALUES ('20120329174000')[0m
|
22
|
+
[1m[35m (0.3ms)[0m SELECT `schema_migrations`.`version` FROM `schema_migrations`
|
23
|
+
Connecting to database specified by database.yml
|
24
|
+
[1m[36m (0.3ms)[0m [1mSELECT `schema_migrations`.`version` FROM `schema_migrations` [0m
|
25
|
+
[1m[35m (0.5ms)[0m DROP DATABASE IF EXISTS `spud_core_test`
|
4
26
|
[1m[36m (0.3ms)[0m [1mCREATE DATABASE `spud_core_test` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`[0m
|
5
|
-
[1m[35m (
|
6
|
-
[1m[36m (
|
7
|
-
[1m[35m (
|
8
|
-
[1m[36m (
|
9
|
-
[1m[35m (
|
10
|
-
[1m[36m (
|
11
|
-
[1m[35m (
|
12
|
-
[1m[36m (0.
|
13
|
-
[1m[35m (
|
14
|
-
[1m[36m (0.
|
15
|
-
[1m[35m (0.
|
16
|
-
[1m[36m (0.
|
17
|
-
[1m[35m (0.
|
27
|
+
[1m[35m (54.2ms)[0m CREATE TABLE `spud_admin_permissions` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `user_id` int(11), `name` varchar(255), `access` tinyint(1), `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, `scope` varchar(255)) ENGINE=InnoDB
|
28
|
+
[1m[36m (177.3ms)[0m [1mCREATE TABLE `spud_user_settings` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `spud_user_id` int(11), `key` varchar(255), `value` varchar(255), `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL) ENGINE=InnoDB[0m
|
29
|
+
[1m[35m (191.0ms)[0m CREATE TABLE `spud_users` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `first_name` varchar(255), `last_name` varchar(255), `super_admin` tinyint(1), `login` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `crypted_password` varchar(255) NOT NULL, `password_salt` varchar(255) NOT NULL, `persistence_token` varchar(255) NOT NULL, `single_access_token` varchar(255) NOT NULL, `perishable_token` varchar(255) NOT NULL, `login_count` int(11) DEFAULT 0 NOT NULL, `failed_login_count` int(11) DEFAULT 0 NOT NULL, `last_request_at` datetime, `current_login_at` datetime, `last_login_at` datetime, `current_login_ip` varchar(255), `last_login_ip` varchar(255), `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, `time_zone` varchar(255)) ENGINE=InnoDB
|
30
|
+
[1m[36m (105.0ms)[0m [1mCREATE INDEX `index_spud_users_on_email` ON `spud_users` (`email`)[0m
|
31
|
+
[1m[35m (100.1ms)[0m CREATE INDEX `index_spud_users_on_login` ON `spud_users` (`login`)
|
32
|
+
[1m[36m (115.5ms)[0m [1mCREATE TABLE `schema_migrations` (`version` varchar(255) NOT NULL) ENGINE=InnoDB[0m
|
33
|
+
[1m[35m (127.3ms)[0m CREATE UNIQUE INDEX `unique_schema_migrations` ON `schema_migrations` (`version`)
|
34
|
+
[1m[36m (0.3ms)[0m [1mSELECT version FROM `schema_migrations`[0m
|
35
|
+
[1m[35m (0.6ms)[0m INSERT INTO `schema_migrations` (version) VALUES ('20120329174000')
|
36
|
+
[1m[36m (0.4ms)[0m [1mINSERT INTO `schema_migrations` (version) VALUES ('20111214161011')[0m
|
37
|
+
[1m[35m (0.4ms)[0m INSERT INTO `schema_migrations` (version) VALUES ('20111214161146')
|
38
|
+
[1m[36m (0.4ms)[0m [1mINSERT INTO `schema_migrations` (version) VALUES ('20120327124229')[0m
|
39
|
+
[1m[35m (0.3ms)[0m INSERT INTO `schema_migrations` (version) VALUES ('20120328235431')
|