alchemy-devise 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Rakefile +39 -0
- data/app/assets/stylesheets/alchemy/custom.scss +2 -0
- data/app/assets/stylesheets/alchemy/login.scss +55 -0
- data/app/assets/stylesheets/alchemy/users.scss +44 -0
- data/app/controllers/alchemy/admin/users_controller.rb +81 -0
- data/app/controllers/alchemy/base_controller_extension.rb +12 -0
- data/app/controllers/alchemy/passwords_controller.rb +31 -0
- data/app/controllers/alchemy/user_sessions_controller.rb +68 -0
- data/app/controllers/alchemy/users_controller.rb +46 -0
- data/app/mailers/alchemy/notifications.rb +33 -0
- data/app/models/alchemy/user.rb +178 -0
- data/app/views/alchemy/admin/users/_table.html.erb +69 -0
- data/app/views/alchemy/admin/users/_user.html.erb +39 -0
- data/app/views/alchemy/admin/users/edit.html.erb +6 -0
- data/app/views/alchemy/admin/users/index.html.erb +58 -0
- data/app/views/alchemy/admin/users/new.html.erb +6 -0
- data/app/views/alchemy/notifications/alchemy_user_created.de.text.erb +15 -0
- data/app/views/alchemy/notifications/alchemy_user_created.en.text.erb +15 -0
- data/app/views/alchemy/notifications/registered_user_created.de.text.erb +13 -0
- data/app/views/alchemy/notifications/registered_user_created.en.text.erb +13 -0
- data/app/views/alchemy/notifications/reset_password_instructions.de.text.erb +8 -0
- data/app/views/alchemy/notifications/reset_password_instructions.en.text.erb +8 -0
- data/app/views/alchemy/passwords/edit.html.erb +35 -0
- data/app/views/alchemy/passwords/new.html.erb +30 -0
- data/app/views/alchemy/user_sessions/new.html.erb +48 -0
- data/app/views/alchemy/users/new.html.erb +14 -0
- data/config/authorization_rules.rb +30 -0
- data/config/initializers/alchemy.rb +19 -0
- data/config/initializers/devise.rb +242 -0
- data/config/locales/alchemy.de.yml +44 -0
- data/config/locales/alchemy.en.yml +41 -0
- data/config/locales/devise.de.yml +58 -0
- data/config/locales/devise.en.yml +60 -0
- data/config/routes.rb +26 -0
- data/config/spring.rb +1 -0
- data/db/migrate/20131015124700_create_alchemy_users.rb +33 -0
- data/db/migrate/20131225232042_add_alchemy_roles_to_alchemy_users.rb +19 -0
- data/lib/alchemy/devise.rb +6 -0
- data/lib/alchemy/devise/engine.rb +20 -0
- data/lib/alchemy/devise/version.rb +5 -0
- metadata +153 -0
data/config/routes.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
Alchemy::Engine.routes.draw do
|
2
|
+
devise_for :user,
|
3
|
+
class_name: 'Alchemy::User',
|
4
|
+
controllers: {
|
5
|
+
sessions: 'alchemy/user_sessions'
|
6
|
+
},
|
7
|
+
skip: [:sessions, :passwords]
|
8
|
+
|
9
|
+
resources :users, only: [:create]
|
10
|
+
|
11
|
+
devise_scope :user do
|
12
|
+
get '/admin/signup' => 'users#new', :as => :signup
|
13
|
+
get '/admin/login' => 'user_sessions#new', :as => :login
|
14
|
+
post '/admin/login' => 'user_sessions#create'
|
15
|
+
delete '/admin/logout' => 'user_sessions#destroy', :as => :logout
|
16
|
+
get '/admin/dashboard' => 'admin/dashboard#index', :as => :user_root
|
17
|
+
get '/admin/passwords' => 'passwords#new', :as => :new_password
|
18
|
+
get '/admin/passwords/:id/edit/:reset_password_token' => 'passwords#edit', :as => :edit_password
|
19
|
+
post '/admin/passwords' => 'passwords#create', :as => :reset_password
|
20
|
+
put '/admin/passwords' => 'passwords#update', :as => :update_password
|
21
|
+
end
|
22
|
+
|
23
|
+
namespace :admin do
|
24
|
+
resources :users
|
25
|
+
end
|
26
|
+
end
|
data/config/spring.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Spring.application_root = './spec/dummy'
|
@@ -0,0 +1,33 @@
|
|
1
|
+
class CreateAlchemyUsers < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
return if table_exists?(:alchemy_users)
|
4
|
+
create_table "alchemy_users" do |t|
|
5
|
+
t.string "firstname"
|
6
|
+
t.string "lastname"
|
7
|
+
t.string "login"
|
8
|
+
t.string "email"
|
9
|
+
t.string "gender"
|
10
|
+
t.string "language"
|
11
|
+
t.string "encrypted_password", limit: 128, default: "", null: false
|
12
|
+
t.string "password_salt", limit: 128, default: "", null: false
|
13
|
+
t.integer "sign_in_count", default: 0, null: false
|
14
|
+
t.integer "failed_attempts", default: 0, null: false
|
15
|
+
t.datetime "last_request_at"
|
16
|
+
t.datetime "current_sign_in_at"
|
17
|
+
t.datetime "last_sign_in_at"
|
18
|
+
t.string "current_sign_in_ip"
|
19
|
+
t.string "last_sign_in_ip"
|
20
|
+
t.datetime "created_at", null: false
|
21
|
+
t.datetime "updated_at", null: false
|
22
|
+
t.integer "creator_id"
|
23
|
+
t.integer "updater_id"
|
24
|
+
t.text "cached_tag_list"
|
25
|
+
t.string "reset_password_token"
|
26
|
+
t.datetime "reset_password_sent_at"
|
27
|
+
end
|
28
|
+
|
29
|
+
add_index "alchemy_users", ["email"], name: "index_alchemy_users_on_email", unique: true
|
30
|
+
add_index "alchemy_users", ["login"], name: "index_alchemy_users_on_login", unique: true
|
31
|
+
add_index "alchemy_users", ["reset_password_token"], name: "index_alchemy_users_on_reset_password_token", unique: true
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class AddAlchemyRolesToAlchemyUsers < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
# Updating old :roles column (since Alchemy CMS v2.6)
|
4
|
+
if column_exists?(:alchemy_users, :roles)
|
5
|
+
remove_index :alchemy_users, name: "index_alchemy_users_on_roles"
|
6
|
+
rename_column :alchemy_users, :roles, :alchemy_roles
|
7
|
+
change_column :alchemy_users, :alchemy_roles, :string, default: "registered"
|
8
|
+
end
|
9
|
+
|
10
|
+
# Creating :alchemy_roles column for new apps.
|
11
|
+
unless column_exists?(:alchemy_users, :alchemy_roles)
|
12
|
+
add_column :alchemy_users, :alchemy_roles, :string, default: "registered"
|
13
|
+
end
|
14
|
+
|
15
|
+
unless index_exists?(:alchemy_users, :alchemy_roles, name: "index_alchemy_users_on_alchemy_roles")
|
16
|
+
add_index :alchemy_users, :alchemy_roles, name: "index_alchemy_users_on_alchemy_roles"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'alchemy_cms'
|
2
|
+
require 'devise'
|
3
|
+
|
4
|
+
module Alchemy
|
5
|
+
module Devise
|
6
|
+
class Engine < ::Rails::Engine
|
7
|
+
isolate_namespace Alchemy
|
8
|
+
engine_name 'alchemy_devise'
|
9
|
+
|
10
|
+
initializer "alchemy_devise.add_authorization_rules" do
|
11
|
+
rules = File.join(File.dirname(__FILE__), '../../..', 'config/authorization_rules.rb')
|
12
|
+
Alchemy::Auth::Engine.get_instance.load(rules)
|
13
|
+
end
|
14
|
+
|
15
|
+
config.to_prepare do
|
16
|
+
require_relative '../../../app/controllers/alchemy/base_controller_extension.rb'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,153 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: alchemy-devise
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Thomas von Deyen
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-06-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: alchemy_cms
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.9.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.9.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: devise
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 3.0.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 3.0.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec-rails
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.9'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.9'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: capybara
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: factory_girl_rails
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: Devise based user authentication for Alchemy CMS.
|
84
|
+
email:
|
85
|
+
- tvd@magiclabs.de
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- Rakefile
|
91
|
+
- app/assets/stylesheets/alchemy/custom.scss
|
92
|
+
- app/assets/stylesheets/alchemy/login.scss
|
93
|
+
- app/assets/stylesheets/alchemy/users.scss
|
94
|
+
- app/controllers/alchemy/admin/users_controller.rb
|
95
|
+
- app/controllers/alchemy/base_controller_extension.rb
|
96
|
+
- app/controllers/alchemy/passwords_controller.rb
|
97
|
+
- app/controllers/alchemy/user_sessions_controller.rb
|
98
|
+
- app/controllers/alchemy/users_controller.rb
|
99
|
+
- app/mailers/alchemy/notifications.rb
|
100
|
+
- app/models/alchemy/user.rb
|
101
|
+
- app/views/alchemy/admin/users/_table.html.erb
|
102
|
+
- app/views/alchemy/admin/users/_user.html.erb
|
103
|
+
- app/views/alchemy/admin/users/edit.html.erb
|
104
|
+
- app/views/alchemy/admin/users/index.html.erb
|
105
|
+
- app/views/alchemy/admin/users/new.html.erb
|
106
|
+
- app/views/alchemy/notifications/alchemy_user_created.de.text.erb
|
107
|
+
- app/views/alchemy/notifications/alchemy_user_created.en.text.erb
|
108
|
+
- app/views/alchemy/notifications/registered_user_created.de.text.erb
|
109
|
+
- app/views/alchemy/notifications/registered_user_created.en.text.erb
|
110
|
+
- app/views/alchemy/notifications/reset_password_instructions.de.text.erb
|
111
|
+
- app/views/alchemy/notifications/reset_password_instructions.en.text.erb
|
112
|
+
- app/views/alchemy/passwords/edit.html.erb
|
113
|
+
- app/views/alchemy/passwords/new.html.erb
|
114
|
+
- app/views/alchemy/user_sessions/new.html.erb
|
115
|
+
- app/views/alchemy/users/new.html.erb
|
116
|
+
- config/authorization_rules.rb
|
117
|
+
- config/initializers/alchemy.rb
|
118
|
+
- config/initializers/devise.rb
|
119
|
+
- config/locales/alchemy.de.yml
|
120
|
+
- config/locales/alchemy.en.yml
|
121
|
+
- config/locales/devise.de.yml
|
122
|
+
- config/locales/devise.en.yml
|
123
|
+
- config/routes.rb
|
124
|
+
- config/spring.rb
|
125
|
+
- db/migrate/20131015124700_create_alchemy_users.rb
|
126
|
+
- db/migrate/20131225232042_add_alchemy_roles_to_alchemy_users.rb
|
127
|
+
- lib/alchemy/devise.rb
|
128
|
+
- lib/alchemy/devise/engine.rb
|
129
|
+
- lib/alchemy/devise/version.rb
|
130
|
+
homepage: http://alchemy-cms.com
|
131
|
+
licenses: []
|
132
|
+
metadata: {}
|
133
|
+
post_install_message:
|
134
|
+
rdoc_options: []
|
135
|
+
require_paths:
|
136
|
+
- lib
|
137
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - ">="
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - ">="
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0'
|
147
|
+
requirements: []
|
148
|
+
rubyforge_project:
|
149
|
+
rubygems_version: 2.2.2
|
150
|
+
signing_key:
|
151
|
+
specification_version: 4
|
152
|
+
summary: Devise based user authentication for Alchemy CMS.
|
153
|
+
test_files: []
|