authentasaurus 0.4.1
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/MIT-LICENSE +20 -0
- data/README.rdoc +173 -0
- data/TODO +4 -0
- data/app/controllers/areas_controller.rb +4 -0
- data/app/controllers/groups_controller.rb +4 -0
- data/app/controllers/permissions_controller.rb +4 -0
- data/app/controllers/recoveries_controller.rb +2 -0
- data/app/controllers/registrations_controller.rb +2 -0
- data/app/controllers/sessions_controller.rb +2 -0
- data/app/controllers/user_invitations_controller.rb +4 -0
- data/app/controllers/users_controller.rb +4 -0
- data/app/controllers/validations_controller.rb +2 -0
- data/app/models/area.rb +2 -0
- data/app/models/authentasaurus_emailer.rb +2 -0
- data/app/models/group.rb +2 -0
- data/app/models/permission.rb +2 -0
- data/app/models/recovery.rb +2 -0
- data/app/models/session.rb +2 -0
- data/app/models/user.rb +3 -0
- data/app/models/user_invitation.rb +2 -0
- data/app/models/user_sync.rb +3 -0
- data/app/models/validation.rb +2 -0
- data/app/views/areas/edit.html.erb +7 -0
- data/app/views/areas/index.html.erb +11 -0
- data/app/views/areas/new.html.erb +7 -0
- data/app/views/areas/show.html.erb +7 -0
- data/app/views/authentasaurus_emailer/invitation_mail.html.erb +4 -0
- data/app/views/authentasaurus_emailer/recovery_mail.html.erb +7 -0
- data/app/views/authentasaurus_emailer/validation_mail.html.erb +6 -0
- data/app/views/groups/edit.html.erb +7 -0
- data/app/views/groups/index.html.erb +11 -0
- data/app/views/groups/new.html.erb +7 -0
- data/app/views/groups/show.html.erb +7 -0
- data/app/views/permissions/edit.html.erb +19 -0
- data/app/views/permissions/index.html.erb +17 -0
- data/app/views/permissions/new.html.erb +19 -0
- data/app/views/permissions/show.html.erb +7 -0
- data/app/views/recoveries/edit.html.erb +24 -0
- data/app/views/recoveries/new.html.erb +15 -0
- data/app/views/registrations/new.html.erb +21 -0
- data/app/views/sessions/new.html.erb +41 -0
- data/app/views/sessions/no_access.html.erb +1 -0
- data/app/views/user_invitations/index.html.erb +14 -0
- data/app/views/user_invitations/new.html.erb +9 -0
- data/app/views/users/edit.html.erb +27 -0
- data/app/views/users/index.html.erb +19 -0
- data/app/views/users/new.html.erb +27 -0
- data/app/views/users/show.html.erb +11 -0
- data/app/views/validations/activate.html.erb +6 -0
- data/app/views/validations/resend_validation_email.html.erb +6 -0
- data/config/locales/en.yml +34 -0
- data/generators/authentasaurus/USAGE +2 -0
- data/generators/authentasaurus/authentasaurus_generator.rb +9 -0
- data/generators/authentasaurus/templates/authentasaurus_tasks.rake +48 -0
- data/generators/authentasaurus/templates/defaults.yml +51 -0
- data/generators/authentasaurus/templates/initializer.rb +3 -0
- data/generators/authentasaurus_views/USAGE +12 -0
- data/generators/authentasaurus_views/authentasaurus_views_generator.rb +87 -0
- data/generators/authentasaurus_views/templates/views/areas/edit.html.erb +7 -0
- data/generators/authentasaurus_views/templates/views/areas/index.html.erb +11 -0
- data/generators/authentasaurus_views/templates/views/areas/new.html.erb +7 -0
- data/generators/authentasaurus_views/templates/views/areas/show.html.erb +7 -0
- data/generators/authentasaurus_views/templates/views/authentasaurus_emailer/invitation_mail.html.erb +4 -0
- data/generators/authentasaurus_views/templates/views/authentasaurus_emailer/recovery_mail.html.erb +7 -0
- data/generators/authentasaurus_views/templates/views/authentasaurus_emailer/validation_mail.html.erb +6 -0
- data/generators/authentasaurus_views/templates/views/groups/edit.html.erb +7 -0
- data/generators/authentasaurus_views/templates/views/groups/index.html.erb +11 -0
- data/generators/authentasaurus_views/templates/views/groups/new.html.erb +7 -0
- data/generators/authentasaurus_views/templates/views/groups/show.html.erb +7 -0
- data/generators/authentasaurus_views/templates/views/permissions/edit.html.erb +19 -0
- data/generators/authentasaurus_views/templates/views/permissions/index.html.erb +17 -0
- data/generators/authentasaurus_views/templates/views/permissions/new.html.erb +19 -0
- data/generators/authentasaurus_views/templates/views/permissions/show.html.erb +7 -0
- data/generators/authentasaurus_views/templates/views/recoveries/edit.html.erb +24 -0
- data/generators/authentasaurus_views/templates/views/recoveries/new.html.erb +15 -0
- data/generators/authentasaurus_views/templates/views/registrations/new.html.erb +21 -0
- data/generators/authentasaurus_views/templates/views/sessions/new.html.erb +41 -0
- data/generators/authentasaurus_views/templates/views/sessions/no_access.html.erb +1 -0
- data/generators/authentasaurus_views/templates/views/user_invitations/index.html.erb +14 -0
- data/generators/authentasaurus_views/templates/views/user_invitations/new.html.erb +9 -0
- data/generators/authentasaurus_views/templates/views/users/edit.html.erb +27 -0
- data/generators/authentasaurus_views/templates/views/users/index.html.erb +19 -0
- data/generators/authentasaurus_views/templates/views/users/new.html.erb +27 -0
- data/generators/authentasaurus_views/templates/views/users/show.html.erb +11 -0
- data/generators/authentasaurus_views/templates/views/validations/activate.html.erb +6 -0
- data/generators/authentasaurus_views/templates/views/validations/resend_validation_email.html.erb +6 -0
- data/lib/action_controller/authorization.rb +215 -0
- data/lib/action_view/authorization.rb +123 -0
- data/lib/active_record/acts_as_authenticatable.rb +80 -0
- data/lib/active_record/acts_as_authenticatable_validatable.rb +32 -0
- data/lib/active_record/authenticatable.rb +56 -0
- data/lib/active_resource/acts_as_authenticatable.rb +42 -0
- data/lib/active_resource/authenticatable.rb +22 -0
- data/lib/authentasaurus.rb +21 -0
- data/lib/authentasaurus/areas_controller.rb +71 -0
- data/lib/authentasaurus/authentasaurus_controller.rb +2 -0
- data/lib/authentasaurus/groups_controller.rb +73 -0
- data/lib/authentasaurus/models/area.rb +8 -0
- data/lib/authentasaurus/models/authentasaurus_emailer.rb +31 -0
- data/lib/authentasaurus/models/group.rb +8 -0
- data/lib/authentasaurus/models/permission.rb +9 -0
- data/lib/authentasaurus/models/recovery.rb +23 -0
- data/lib/authentasaurus/models/session.rb +63 -0
- data/lib/authentasaurus/models/user_invitation.rb +21 -0
- data/lib/authentasaurus/models/validation.rb +18 -0
- data/lib/authentasaurus/permissions_controller.rb +71 -0
- data/lib/authentasaurus/recoveries_controller.rb +59 -0
- data/lib/authentasaurus/registrations_controller.rb +32 -0
- data/lib/authentasaurus/sessions_controller.rb +45 -0
- data/lib/authentasaurus/user_invitations_controller.rb +39 -0
- data/lib/authentasaurus/users_controller.rb +71 -0
- data/lib/authentasaurus/validations_controller.rb +34 -0
- data/lib/helpers/migrations.rb +171 -0
- data/lib/helpers/routing.rb +90 -0
- data/rails/init.rb +37 -0
- metadata +188 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
class Authentasaurus::UserInvitationsController < Authentasaurus::AuthentasaurusController
|
|
2
|
+
|
|
3
|
+
def index
|
|
4
|
+
@invitations = UserInvitation.find :all
|
|
5
|
+
|
|
6
|
+
respond_to do |format|
|
|
7
|
+
format.html
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def new
|
|
12
|
+
@invitation = UserInvitation.new
|
|
13
|
+
|
|
14
|
+
respond_to do |format|
|
|
15
|
+
format.html
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def create
|
|
20
|
+
@invitation = UserInvitation.new params[:user_invitation]
|
|
21
|
+
|
|
22
|
+
respond_to do |format|
|
|
23
|
+
if @invitation.save
|
|
24
|
+
format.html { redirect_to :action => :index }
|
|
25
|
+
else
|
|
26
|
+
format.html {render :new}
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def destroy
|
|
32
|
+
invitation = UserInvitation.find params[:id]
|
|
33
|
+
invitation.destroy
|
|
34
|
+
|
|
35
|
+
respond_to do |format|
|
|
36
|
+
format.html { redirect_to :action => :index }
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
class Authentasaurus::UsersController < Authentasaurus::AuthentasaurusController
|
|
2
|
+
|
|
3
|
+
def index
|
|
4
|
+
@users = User.all
|
|
5
|
+
|
|
6
|
+
respond_to do |format|
|
|
7
|
+
format.html
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def show
|
|
12
|
+
@user = User.find(params[:id])
|
|
13
|
+
|
|
14
|
+
respond_to do |format|
|
|
15
|
+
format.html
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def new
|
|
20
|
+
@user = User.new
|
|
21
|
+
|
|
22
|
+
respond_to do |format|
|
|
23
|
+
format.html
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def create
|
|
28
|
+
@user = User.new params[:user]
|
|
29
|
+
|
|
30
|
+
respond_to do |format|
|
|
31
|
+
if @user.save
|
|
32
|
+
flash.now[:notice] = "User saved successfully"
|
|
33
|
+
format.html { redirect_to :action=>:index }
|
|
34
|
+
else
|
|
35
|
+
flash.now[:notice] = "Error saving user"
|
|
36
|
+
format.html { render :new }
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def edit
|
|
42
|
+
@user = User.find params[:id]
|
|
43
|
+
|
|
44
|
+
respond_to do |format|
|
|
45
|
+
format.html
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def update
|
|
50
|
+
@user = User.find params[:id]
|
|
51
|
+
|
|
52
|
+
respond_to do |format|
|
|
53
|
+
if @user.update_attributes(params[:user])
|
|
54
|
+
flash.now[:notice] = "User updated"
|
|
55
|
+
format.html { redirect_to @user }
|
|
56
|
+
else
|
|
57
|
+
flash.now[:notice] = "Error updating user"
|
|
58
|
+
format.html { render :edit }
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def destroy
|
|
64
|
+
@user = User.find params[:id]
|
|
65
|
+
@user.destroy
|
|
66
|
+
|
|
67
|
+
respond_to do |format|
|
|
68
|
+
format.html { redirect_to :action=>:index }
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
class Authentasaurus::ValidationsController < Authentasaurus::AuthentasaurusController
|
|
2
|
+
def validate
|
|
3
|
+
respond_to do |format|
|
|
4
|
+
validation = Validation.find_by_validation_code(params[:vcode])
|
|
5
|
+
if validation
|
|
6
|
+
validation.user.activate
|
|
7
|
+
validation.destroy
|
|
8
|
+
format.html { redirect_to login_url, :notice => I18n.t(:validation_successful, :scope => [:authentasaurus, :messages, :validations])}
|
|
9
|
+
else
|
|
10
|
+
self.alert = I18n.t(:validation_failed, :scope => [:authentasaurus, :messages, :validations])
|
|
11
|
+
format.html
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def resend_validation_email
|
|
17
|
+
respond_to do |format|
|
|
18
|
+
format.html
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def do_resend_validation_email
|
|
23
|
+
validation = Validation.find_by_email params[:email]
|
|
24
|
+
|
|
25
|
+
respond_to do |format|
|
|
26
|
+
unless validation.nil?
|
|
27
|
+
validation.send_validation
|
|
28
|
+
format.html {redirect_to login_url, :notice => I18n.t(:validation_email_sent, :scope => [:authentasaurus, :messages, :validations])}
|
|
29
|
+
else
|
|
30
|
+
format.html {render :resend_validation_email, :alert => I18n.t(:validation_email_invalid, :scope => [:authentasaurus, :messages, :validations], :email => params[:email])}
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
module Helpers::Migrations
|
|
2
|
+
# Extends ActiveRecord::ConnectionAdapters::SchemaStatements
|
|
3
|
+
module Tables
|
|
4
|
+
def self.included(base) # :nodoc:
|
|
5
|
+
base.send :include, InstanceMethods
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
module InstanceMethods
|
|
9
|
+
# creates all tables
|
|
10
|
+
def authentasaurus_tables
|
|
11
|
+
authentasaurus_user :authorizable
|
|
12
|
+
authentasaurus_group
|
|
13
|
+
authentasaurus_area
|
|
14
|
+
authentasaurus_permission
|
|
15
|
+
authentasaurus_validation
|
|
16
|
+
authentasaurus_user_invitation
|
|
17
|
+
authentasaurus_recovery
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# creates users table
|
|
21
|
+
def authentasaurus_user(*opts)
|
|
22
|
+
create_table :users do |t|
|
|
23
|
+
t.string :username, :null => false
|
|
24
|
+
t.string :hashed_password, :null => false
|
|
25
|
+
t.string :password_seed, :null => false
|
|
26
|
+
t.string :name, :null => false
|
|
27
|
+
t.string :email, :null => false
|
|
28
|
+
t.boolean :active, :null => false, :default => false
|
|
29
|
+
t.string :remember_me_token
|
|
30
|
+
|
|
31
|
+
if opts.include?(:authorizable) || opts.include?("authorizable")
|
|
32
|
+
t.integer :group_id, :null => false
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
t.timestamps
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# creates groups table
|
|
40
|
+
def authentasaurus_group
|
|
41
|
+
create_table :groups do |t|
|
|
42
|
+
t.string :name, :null => false
|
|
43
|
+
|
|
44
|
+
t.timestamps
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# creates areas table
|
|
49
|
+
def authentasaurus_area
|
|
50
|
+
create_table :areas do |t|
|
|
51
|
+
t.string :name, :null => false
|
|
52
|
+
|
|
53
|
+
t.timestamps
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# creates permissions table
|
|
58
|
+
def authentasaurus_permission
|
|
59
|
+
create_table :permissions do |t|
|
|
60
|
+
t.integer :group_id, :null => false
|
|
61
|
+
t.integer :area_id, :null => false
|
|
62
|
+
t.boolean :read, :null => false
|
|
63
|
+
t.boolean :write, :null => false
|
|
64
|
+
|
|
65
|
+
t.timestamps
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# creates validations table
|
|
70
|
+
def authentasaurus_validation
|
|
71
|
+
create_table :validations do |t|
|
|
72
|
+
t.integer :user_id, :null => false
|
|
73
|
+
t.string :user_type, :null => false
|
|
74
|
+
t.string :email, :null => false
|
|
75
|
+
t.string :validation_code, :null => false
|
|
76
|
+
|
|
77
|
+
t.timestamps
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# creates user_invitations table
|
|
82
|
+
def authentasaurus_user_invitation
|
|
83
|
+
create_table :user_invitations do |t|
|
|
84
|
+
t.string :token, :null => false, :unique => true
|
|
85
|
+
t.string :email
|
|
86
|
+
|
|
87
|
+
t.timestamps
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# creates recoveries table
|
|
92
|
+
def authentasaurus_recovery
|
|
93
|
+
create_table :recoveries do |t|
|
|
94
|
+
t.integer :user_id, :null => false
|
|
95
|
+
t.string :email, :null => false
|
|
96
|
+
t.string :token, :null => false, :unique => true
|
|
97
|
+
|
|
98
|
+
t.timestamps
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# drops all tables
|
|
103
|
+
def authentasaurus_drop_tables
|
|
104
|
+
authentasaurus_drop_user
|
|
105
|
+
authentasaurus_drop_group
|
|
106
|
+
authentasaurus_drop_area
|
|
107
|
+
authentasaurus_drop_permission
|
|
108
|
+
authentasaurus_drop_validation
|
|
109
|
+
authentasaurus_drop_user_invitation
|
|
110
|
+
authentasaurus_drop_recovery
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# drops users table
|
|
114
|
+
def authentasaurus_drop_user
|
|
115
|
+
drop_table :users
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# drops groups table
|
|
119
|
+
def authentasaurus_drop_group
|
|
120
|
+
drop_table :groups
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# drops areas table
|
|
124
|
+
def authentasaurus_drop_area
|
|
125
|
+
drop_table :areas
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# drops permissions table
|
|
129
|
+
def authentasaurus_drop_permission
|
|
130
|
+
drop_table :permissions
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
# drops validations table
|
|
134
|
+
def authentasaurus_drop_validation
|
|
135
|
+
drop_table :validations
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
# drops user_invitations table
|
|
139
|
+
def authentasaurus_drop_user_invitation
|
|
140
|
+
drop_table :user_invitations
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# drops recoveries table
|
|
144
|
+
def authentasaurus_drop_recovery
|
|
145
|
+
drop_table :recoveries
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
# Extends ActiveRecord::ConnectionAdapters::TableDefinition
|
|
151
|
+
module Columns
|
|
152
|
+
def self.included(base) # :nodoc:
|
|
153
|
+
base.send :include, InstanceMethods
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
module InstanceMethods
|
|
157
|
+
def user
|
|
158
|
+
string :username, :null => false
|
|
159
|
+
string :hashed_password, :null => false
|
|
160
|
+
string :password_seed, :null => false
|
|
161
|
+
string :name, :null => false
|
|
162
|
+
string :email, :null => false
|
|
163
|
+
string :remember_me_token
|
|
164
|
+
boolean :active, :null => false, :default => false
|
|
165
|
+
if opts.include?(:authorizable)
|
|
166
|
+
t.integer :group_id, :null => false
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
end
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
## Authentasaurus routes helper
|
|
2
|
+
module Helpers::Routing
|
|
3
|
+
def self.included(base) # :nodoc:
|
|
4
|
+
base.send :include, InstanceMethods
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
module InstanceMethods
|
|
8
|
+
# TODO: add documentation here
|
|
9
|
+
def authentasaurus_routes(*opts)
|
|
10
|
+
options = opts.extract_options!
|
|
11
|
+
|
|
12
|
+
# Authenticatable
|
|
13
|
+
authentasaurus_sessions options.dup
|
|
14
|
+
authentasaurus_users options.dup
|
|
15
|
+
# Recoverable
|
|
16
|
+
authentasaurus_recoverable options.dup
|
|
17
|
+
|
|
18
|
+
# Authorizable
|
|
19
|
+
if opts.include?(:authorizable)
|
|
20
|
+
authentasaurus_authorizable options.dup
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Validatable
|
|
24
|
+
if opts.include?(:validatable)
|
|
25
|
+
authentasaurus_validatable options.dup
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Invitable
|
|
29
|
+
if opts.include?(:invitable)
|
|
30
|
+
authentasaurus_invitable options.dup
|
|
31
|
+
authentasaurus_invitable_public
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# TODO: add documentation here
|
|
36
|
+
def authentasaurus_sessions(*opts)
|
|
37
|
+
options = opts.extract_options!
|
|
38
|
+
|
|
39
|
+
resources :sessions, options.dup.merge({:except => [:index, :show, :edit, :update], :path_names => {:new => 'sign-in'}, :member => {:no_access => :get}})
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# TODO: add documentation here
|
|
43
|
+
def authentasaurus_users(*opts)
|
|
44
|
+
options = opts.extract_options!
|
|
45
|
+
|
|
46
|
+
resources :users, options.dup
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# TODO: add documentation here
|
|
50
|
+
def authentasaurus_authorizable(*opts)
|
|
51
|
+
options = opts.extract_options!
|
|
52
|
+
|
|
53
|
+
resources :groups, options.dup
|
|
54
|
+
resources :areas, options.dup
|
|
55
|
+
resources :permissions, options.dup
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# TODO: add documentation here
|
|
59
|
+
def authentasaurus_validatable(*opts)
|
|
60
|
+
options = opts.extract_options!
|
|
61
|
+
|
|
62
|
+
validate "/validate", options.dup.merge({:controller => :validations, :action => :activate})
|
|
63
|
+
resend_validation_email "/resend-validation", options.dup.merge({:controller => :validations, :action => :resend_validation_email, :conditions => {:method => :get}})
|
|
64
|
+
do_resend_validation_email "/resend-validation", options.dup.merge({:controller => :validations, :action => :do_resend_validation_email, :conditions => {:method => :post}})
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# TODO: add documentation here
|
|
68
|
+
def authentasaurus_invitable(*opts)
|
|
69
|
+
options = opts.extract_options!
|
|
70
|
+
|
|
71
|
+
resources :user_invitations, options.dup.merge({:except => [:show, :edit, :update]})
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def authentasaurus_invitable_public(*opts)
|
|
75
|
+
options = opts.extract_options!
|
|
76
|
+
|
|
77
|
+
resources :registrations, :only => [:new, :create], :path_prefix => "/:token", :requirements => {:token => /[0-9a-zA-Z]+/}
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# TODO: add documentation here
|
|
81
|
+
def authentasaurus_recoverable(*opts)
|
|
82
|
+
options = opts.extract_options!
|
|
83
|
+
|
|
84
|
+
forgot_password "/forgot-password", options.dup.merge({ :controller => :recoveries, :action => :new, :conditions => { :method => :get } })
|
|
85
|
+
do_forgot_password "/forgot-password", options.dup.merge({ :controller => :recoveries, :action => :create, :conditions => { :method => :post } })
|
|
86
|
+
recover_password "/recover-password/:token", options.dup.merge({ :controller => :recoveries, :action => :edit, :conditions => { :method => :get } })
|
|
87
|
+
do_recover_password "/recover-password/:token", options.dup.merge({ :controller => :recoveries, :action => :destroy, :conditions => { :method => :delete } })
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
data/rails/init.rb
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
require 'action_controller/authorization'
|
|
2
|
+
require 'action_view/authorization'
|
|
3
|
+
require 'active_record/authenticatable'
|
|
4
|
+
require 'active_resource/authenticatable'
|
|
5
|
+
require 'helpers/routing'
|
|
6
|
+
require 'helpers/migrations'
|
|
7
|
+
|
|
8
|
+
if defined? ActionController
|
|
9
|
+
class ActionController::Base
|
|
10
|
+
include ActionController::Authorization
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
class ActionView::Base
|
|
14
|
+
include ActionView::Authorization
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
class ActionController::Routing::RouteSet::Mapper
|
|
18
|
+
include Helpers::Routing
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
if defined? ActiveRecord
|
|
23
|
+
class ActiveRecord::Base
|
|
24
|
+
include ActiveRecord::Authenticatable
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
class ActiveRecord::ConnectionAdapters::AbstractAdapter
|
|
28
|
+
include Helpers::Migrations::Tables
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
if defined? ActiveResource
|
|
33
|
+
class ActiveResource::Base
|
|
34
|
+
class_inheritable_accessor :sync, :sync_to
|
|
35
|
+
include ActiveResource::Authenticatable
|
|
36
|
+
end
|
|
37
|
+
end
|