user_authentication 0.0.3 → 0.0.4

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/app/models/user.rb CHANGED
@@ -1,5 +1,8 @@
1
- class User < ActiveRecord::Base
2
- validates_presence_of :email
1
+ require File.expand_path('../../../lib/random', __FILE__)
3
2
 
3
+ class User < ActiveRecord::Base
4
4
  has_secure_password
5
+
6
+ before_validation { |user| user.password = Random.password if user.password.nil? }
7
+ validates_presence_of :email
5
8
  end
@@ -0,0 +1,8 @@
1
+ require File.expand_path('../../../lib/random', __FILE__)
2
+
3
+ class User < ActiveRecord::Base
4
+ has_secure_password
5
+
6
+ before_validation { |user| user.password = random_password if user.password.nil? }
7
+ validates_presence_of :email
8
+ end
@@ -0,0 +1,11 @@
1
+ <%= form_tag login_path do %>
2
+ <%= label_tag :email %>
3
+ <br>
4
+ <%= text_field_tag :email, params[:email] %>
5
+ <br>
6
+ <%= label_tag :password %>
7
+ <br>
8
+ <%= password_field_tag :password %>
9
+ <br>
10
+ <%= submit_tag "Log In" %>
11
+ <% end %>
data/lib/random.rb ADDED
@@ -0,0 +1,6 @@
1
+ class Random
2
+ def self.password
3
+ chars = ('A'..'Z').to_a + ('a'..'z').to_a + ('0'..'9').to_a
4
+ (1..32).map { chars.sample }.join('')
5
+ end
6
+ end
data/lib/random.rb~ ADDED
@@ -0,0 +1,8 @@
1
+ class Random
2
+ def self.password
3
+ chars = ("A".."Z").to_a + ("a".."z").to_a + ("0".."9").to_a
4
+ password = (1..32).map { chars.sample }.join("")
5
+ puts "Returning: #{password}"
6
+ password
7
+ end
8
+ end
@@ -1,3 +1,3 @@
1
1
  module UserAuthentication
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -1,3 +1,3 @@
1
1
  module UserAuthentication
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: user_authentication
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-12 00:00:00.000000000 Z
12
+ date: 2012-10-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -139,6 +139,22 @@ dependencies:
139
139
  - - ~>
140
140
  - !ruby/object:Gem::Version
141
141
  version: 0.0.1
142
+ - !ruby/object:Gem::Dependency
143
+ name: webrat
144
+ requirement: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ! '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ type: :development
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
142
158
  description: A rails engine for email and password based user authentication.
143
159
  email:
144
160
  - sujoyg@gmail.com
@@ -149,8 +165,12 @@ files:
149
165
  - app/controllers/application_controller.rb
150
166
  - app/controllers/users_controller.rb
151
167
  - app/models/user.rb
168
+ - app/models/user.rb~
169
+ - app/views/users/_login.html.erb
152
170
  - config/routes.rb
153
171
  - db/migrate/20121009010000_create_users.rb
172
+ - lib/random.rb
173
+ - lib/random.rb~
154
174
  - lib/tasks/user_authentication_tasks.rake
155
175
  - lib/user_authentication/version.rb
156
176
  - lib/user_authentication/version.rb~