perens-instant-user 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +56 -0
- data/app/models/perens/instant_user/user.rb +10 -0
- data/app/models/perens/instant_user.rb +5 -0
- data/config/initializers/devise.rb +3 -0
- data/config/routes.rb +6 -0
- data/db/migrate/20120103011557_create_perens_instant_user_users.rb +50 -0
- data/lib/perens/instant_user/engine.rb +12 -0
- data/lib/perens/instant_user/version.rb +5 -0
- data/lib/perens-instant-user.rb +2 -0
- data/perens-instant-user-0.0.1.gem +0 -0
- metadata +122 -0
data/README.rdoc
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
= Perens::InstantUser
|
2
|
+
|
3
|
+
Perens::InstantUser is a Rails Engine that makes it as easy as possible to
|
4
|
+
add user management: logins, authentication, sign-up, etc., to your Rails
|
5
|
+
application.
|
6
|
+
|
7
|
+
* All of the user management services are provided by the Devise gem, but
|
8
|
+
we've done most of the *work* that it would otherwise take to install devise.
|
9
|
+
The engine provides pre-configured routes and a User model.
|
10
|
+
|
11
|
+
* Rails >= 3.1, Devise >= 2.0.0.rc, and Ruby >= 1.9.3 are required.
|
12
|
+
It's time to make the jump to
|
13
|
+
Ruby 1.9 if you haven't already done so, as Rails 4.0 will require Ruby
|
14
|
+
1.9.3 or greater.
|
15
|
+
|
16
|
+
* This engine is in a *very* early state of development.
|
17
|
+
There is no inline documentation in the code, and there are no tests!
|
18
|
+
But it works (at least for me), and provides
|
19
|
+
a good example of how to use Devise in an engine.
|
20
|
+
|
21
|
+
* My thanks to Devise author and Rails committer José Valim,
|
22
|
+
who upon my request added a set of features to Devise that made it possible
|
23
|
+
to use Devise from an engine.
|
24
|
+
|
25
|
+
== Installation
|
26
|
+
|
27
|
+
* Edit your Gemfile or gemspec to add a dependency on the perens-instant-user gem.
|
28
|
+
* <tt>bundle update</tt>
|
29
|
+
* <tt>rake perens_instant_user:install:migrations</tt>
|
30
|
+
* <tt>rake migrate</tt>
|
31
|
+
* Edit <tt>config/routes.rb</tt>, adding this line:
|
32
|
+
mount Perens::InstantUser::Engine => '/'
|
33
|
+
* Copy http://github.com/plataformatec/devise/blob/master/lib/generators/templates/devise.rb into <tt>config/initializers/devise.rb</tt> and edit it.
|
34
|
+
* Edit one of your environment files, like <tt>config/application.rb</tt>, to add the
|
35
|
+
URL info to be used in email messages to users from the user management
|
36
|
+
system. While testing, this might be:
|
37
|
+
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
|
38
|
+
but it must be set to the correct external URL when your application is
|
39
|
+
running for
|
40
|
+
real users.
|
41
|
+
* Add <tt>user_authenticate!</tt> and other Devise helpers to your controllers
|
42
|
+
as appropriate. See the Devise README.rdoc[https://github.com/plataformatec/devise#readme] for information on the available features.
|
43
|
+
|
44
|
+
== Bugs
|
45
|
+
* Report issues here[https://github.com/BrucePerens/perens-instant-user/issues].
|
46
|
+
|
47
|
+
== To Do
|
48
|
+
* I'm planning to provide a web interface to set the configuration information,
|
49
|
+
removing the need to copy and edit the Devise configuration file and the
|
50
|
+
environment files.
|
51
|
+
|
52
|
+
== Why <tt>Perens::InstantUser</tt> instead of <tt>InstantUser</tt>, and why <tt>perens-instant-user</tt> instead of <tt>instant-user</tt>?
|
53
|
+
Ruby and Rails are large enough that we should not all be sharing the
|
54
|
+
same global namespace. Thus, all of my code will be in the
|
55
|
+
<tt>Perens</tt> module and my gem names will start with <tt>perens-</tt>.
|
56
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
class Perens::InstantUser::User < ActiveRecord::Base
|
2
|
+
# Include default devise modules. Others available are:
|
3
|
+
# :encryptable, :timeoutable and :omniauthable
|
4
|
+
devise :database_authenticatable, :registerable,
|
5
|
+
:recoverable, :rememberable, :trackable, :validatable,
|
6
|
+
:confirmable, :lockable, :token_authenticatable
|
7
|
+
|
8
|
+
# Setup accessible (or protected) attributes for your model
|
9
|
+
attr_accessible :email, :password, :password_confirmation, :remember_me
|
10
|
+
end
|
data/config/routes.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
class CreatePerensInstantUserUsers < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table(:perens_instant_user_users) do |t|
|
4
|
+
## Database authenticatable
|
5
|
+
t.string :email, :null => false, :default => ""
|
6
|
+
t.string :encrypted_password, :null => false, :default => ""
|
7
|
+
|
8
|
+
## Recoverable
|
9
|
+
t.string :reset_password_token
|
10
|
+
t.datetime :reset_password_sent_at
|
11
|
+
|
12
|
+
## Rememberable
|
13
|
+
t.datetime :remember_created_at
|
14
|
+
|
15
|
+
## Trackable
|
16
|
+
t.integer :sign_in_count, :default => 0
|
17
|
+
t.datetime :current_sign_in_at
|
18
|
+
t.datetime :last_sign_in_at
|
19
|
+
t.string :current_sign_in_ip
|
20
|
+
t.string :last_sign_in_ip
|
21
|
+
|
22
|
+
## Encryptable
|
23
|
+
# t.string :password_salt
|
24
|
+
|
25
|
+
## Confirmable
|
26
|
+
t.string :confirmation_token
|
27
|
+
t.datetime :confirmed_at
|
28
|
+
t.datetime :confirmation_sent_at
|
29
|
+
t.string :unconfirmed_email # Only if using reconfirmable
|
30
|
+
|
31
|
+
## Lockable
|
32
|
+
t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts
|
33
|
+
t.string :unlock_token # Only if unlock strategy is :email or :both
|
34
|
+
t.datetime :locked_at
|
35
|
+
|
36
|
+
# Token authenticatable
|
37
|
+
t.string :authentication_token
|
38
|
+
|
39
|
+
|
40
|
+
t.timestamps
|
41
|
+
end
|
42
|
+
|
43
|
+
add_index :perens_instant_user_users, :email, :unique => true
|
44
|
+
add_index :perens_instant_user_users, :reset_password_token, :unique => true
|
45
|
+
add_index :perens_instant_user_users, :confirmation_token, :unique => true
|
46
|
+
add_index :perens_instant_user_users, :unlock_token, :unique => true
|
47
|
+
add_index :perens_instant_user_users, :authentication_token, :unique => true
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
File without changes
|
metadata
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: perens-instant-user
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Bruce Perens
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-01-04 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: devise
|
16
|
+
requirement: &17906180 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 2.0.0rc
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *17906180
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rails
|
27
|
+
requirement: &17905020 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 3.2.rc1
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *17905020
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: haml
|
38
|
+
requirement: &17904000 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *17904000
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: tzinfo
|
49
|
+
requirement: &22098660 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *22098660
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: omniauth
|
60
|
+
requirement: &22098240 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :runtime
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *22098240
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: actionmailer
|
71
|
+
requirement: &22097740 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 3.2.rc1
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *22097740
|
80
|
+
description: An engine that implements user and login handling instantly for an application.
|
81
|
+
It uses the Devise gem to provide all facilities.
|
82
|
+
email:
|
83
|
+
- bruce@perens.com
|
84
|
+
executables: []
|
85
|
+
extensions: []
|
86
|
+
extra_rdoc_files: []
|
87
|
+
files:
|
88
|
+
- ./app/models/perens/instant_user/user.rb
|
89
|
+
- ./app/models/perens/instant_user.rb
|
90
|
+
- ./perens-instant-user-0.0.1.gem
|
91
|
+
- ./db/migrate/20120103011557_create_perens_instant_user_users.rb
|
92
|
+
- ./config/routes.rb
|
93
|
+
- ./config/initializers/devise.rb
|
94
|
+
- ./lib/perens-instant-user.rb
|
95
|
+
- ./lib/perens/instant_user/engine.rb
|
96
|
+
- ./lib/perens/instant_user/version.rb
|
97
|
+
- ./README.rdoc
|
98
|
+
homepage: http://perens.com/
|
99
|
+
licenses: []
|
100
|
+
post_install_message:
|
101
|
+
rdoc_options: []
|
102
|
+
require_paths:
|
103
|
+
- lib
|
104
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
|
+
none: false
|
112
|
+
requirements:
|
113
|
+
- - ! '>='
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
116
|
+
requirements: []
|
117
|
+
rubyforge_project: perens-instant-user
|
118
|
+
rubygems_version: 1.8.11
|
119
|
+
signing_key:
|
120
|
+
specification_version: 3
|
121
|
+
summary: An engine that implements user and login handling instantly for an application.
|
122
|
+
test_files: []
|