jt-rails-generator-user 1.0.5 → 1.0.6
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f34a1b854f33a7b750bbb2b710e9a919cf6c227d
|
4
|
+
data.tar.gz: c782887d8f0251e309c319ad0ae909b775ad9954
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b40630ccba57c63335052cb99dd3e7911c680e09190a31af490b7c55d67bc506ee5a74e4f36f837dad0808813f61935b067473b10620994d3def201622cdf390
|
7
|
+
data.tar.gz: 7c644a85299559db59c402b7c2e958ad8db494b216a90c49253bb61500718b1fe8689f9aea864dccb1f30b62b04529e72c164ea123218f1a438a2a58d7d4a336
|
@@ -3,7 +3,7 @@ Gem::Specification.new do |s|
|
|
3
3
|
s.summary = "Generate a scaffold for user authentication in Ruby On Rails"
|
4
4
|
s.description = "JTRailsGeneratorUser is a generator for user authentication. You have the login and sign up page, password forgot feature."
|
5
5
|
s.homepage = 'https://github.com/jonathantribouharet/jt-rails-generator-user'
|
6
|
-
s.version = '1.0.
|
6
|
+
s.version = '1.0.6'
|
7
7
|
s.files = `git ls-files`.split("\n")
|
8
8
|
s.require_paths = ['lib']
|
9
9
|
s.authors = ['Jonathan TRIBOUHARET']
|
@@ -15,7 +15,7 @@ module UserAuthentication
|
|
15
15
|
|
16
16
|
end
|
17
17
|
|
18
|
-
|
18
|
+
class_methods do
|
19
19
|
|
20
20
|
def authenticate(email, password)
|
21
21
|
self.search_by_email_for_authentication(email).first.try(:authenticate, password)
|
@@ -27,4 +27,14 @@ module UserAuthentication
|
|
27
27
|
self.email.downcase! if self.email
|
28
28
|
end
|
29
29
|
|
30
|
+
def increment_login_stats!(remote_ip)
|
31
|
+
attributes = {
|
32
|
+
last_login_at: Time.now,
|
33
|
+
last_login_remote_ip: remote_ip,
|
34
|
+
login_count: (self.login_count || 0) + 1
|
35
|
+
}
|
36
|
+
|
37
|
+
self.update_columns(attributes)
|
38
|
+
end
|
39
|
+
|
30
40
|
end
|
@@ -4,7 +4,7 @@ module Jt
|
|
4
4
|
source_root File.expand_path("../templates", __FILE__)
|
5
5
|
|
6
6
|
def create_initializer_file
|
7
|
-
generate "migration", "CreateUsers", "email:string password_digest:string password_token:string"
|
7
|
+
generate "migration", "CreateUsers", "email:string password_digest:string password_token:string last_login_at:datetime last_login_remote_ip:string login_count:integer"
|
8
8
|
|
9
9
|
directory 'controllers', 'app/controllers'
|
10
10
|
directory 'mailers', 'app/mailers'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jt-rails-generator-user
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan TRIBOUHARET
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: validates_email_format_of
|