authstrategies 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MzEzMjY1MTdhMDEzYzY2ODY4OWJjYzNkZGU2ZjcxOTk0MzY1MWM4OA==
4
+ NmMxNWM2NDI3YWFhYmIzNjZkYTM3MTYwOGRjOTg3NThkZmM5NTM3MA==
5
5
  data.tar.gz: !binary |-
6
- ZTJmMzk2ZGRiMjUwODM4ZTc5OTYwNTllNjE5M2VmMTFiYzExODVkOQ==
6
+ NTQyNDgzY2E2ZGYwM2UxNGQxODc4ZTExNmYxZTY5ZGU0MmU2ZDFhZg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NzcxOWQ4OWE1ZTBmNmI0MDM4YmEwM2QyN2JjYjk5YmNkNDFjOWFiMGRiNmFk
10
- MGU3MjVmNTI2ZDQzN2IyZWJkMmNjYWU1OTlmYTU0N2M2Y2U5YTJjMGQ0ZTUx
11
- NzIxZDZhOTY3ZjViYjMzN2Q4NGZhODI3YjI5ZTgyZjBkOGVkY2Y=
9
+ YTExZWRhMTNmZmNmOTJlN2Q1NWM3MDAxZjI1ZDc0NzEzZWVkOWJlNjNmOWFk
10
+ OGM0YWE0MzM0NGU0YzNhZTI2YjQ3MjY4NmYyZjZlMzBlM2EwMjliNjlkOWY1
11
+ YjMwNTBkYzZjZGY2OWEwYzZiMjc4YjY2OTA4ZjQ5N2FjNzNjMGU=
12
12
  data.tar.gz: !binary |-
13
- OWZjNTdkNjgwMWM4ZTRlNDVjNWVhZmZlYjU1YzhjZGVjMWU1ZGRkNWVlNWMw
14
- OTJjMzI4YTE2NTA3ODY0ZDY1MDRiZTk4ZmMyNjVmMzU4MTdkYTAxNzNlYTll
15
- ZDFjMmIwOWFkM2YxYzk0YmQ0MjYyOGVlOTMwNjgzZjcwODBjMzk=
13
+ NjEzMjI1YjliZWViZDU2Y2FlNzRkZTUxYWZjMmJmNDI3NjZhOWNiYzRlNGZj
14
+ MDc0OWQ1MDQ5MzQ3ODc3ZTRiNGIwMjRhNjI3NDNhYWNiMTQ4ZGFkNzM4MGJi
15
+ ODAyZTEyMjkwODNlYjExZjk0ZWRiOTE2MTEzOGQ4ZDkyZTMwMWU=
@@ -1,3 +1,3 @@
1
1
  module Authstrategies
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -95,4 +95,4 @@ module Authstrategies
95
95
  end
96
96
 
97
97
  require "authstrategies/helpers"
98
- require "authstrategies/models/User"
98
+ require "authstrategies/user"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authstrategies
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dobromir Ivanov
@@ -124,10 +124,7 @@ files:
124
124
  - authstrategies.gemspec
125
125
  - lib/authstrategies.rb
126
126
  - lib/authstrategies/helpers.rb
127
- - lib/authstrategies/models/User.rb
128
127
  - lib/authstrategies/version.rb
129
- - lib/authstrategies/views/login.erb
130
- - lib/authstrategies/views/signup.erb
131
128
  homepage: ''
132
129
  licenses:
133
130
  - MIT
@@ -1,55 +0,0 @@
1
- require 'bcrypt'
2
- require 'activerecord'
3
-
4
- class User < ActiveRecord::Base
5
- include BCrypt
6
-
7
- validates :email, :password, presence: true
8
- validates :email, uniqueness: true
9
-
10
- validates :password, confirmation: true
11
- validates :password, length: { in: 8..20,
12
- too_long: "%{count} is the maximum allowed!",
13
- too_short: "must be at least %{count}" }
14
-
15
- before_save :encrypt_password
16
- #before_save :set_confirm_token
17
-
18
- def password
19
- @password ||= Password.new(encrypted_password)
20
- end
21
-
22
- def password= password
23
- @password = password
24
- end
25
-
26
- def authenticate request
27
- if self.password == request["password"]
28
- true
29
- else
30
- false
31
- end
32
- end
33
-
34
- def remember_me!
35
- self.update_attributes(:remember_token => new_token)
36
- end
37
-
38
- def forget_me!
39
- self.update_attributes(:remember_token => nil)
40
- end
41
-
42
- private
43
- def encrypt_password
44
- self.encrypted_password = Password.create(@password)
45
- end
46
-
47
- def set_confirm_token
48
- self.confirm_token = new_token
49
- end
50
-
51
- def new_token
52
- Password.create(Time.new.to_s)
53
- end
54
-
55
- end
@@ -1,8 +0,0 @@
1
- <%= flash[:error] %>
2
- <%= flash[:notice] %>
3
- <form action="login" method="post">
4
- <p>Username:<input type="text" name="email" /></p>
5
- <p>Password:<input type="password" name="password" /></p>
6
- <p>Remember Me: <input type="radio" name="remember_me" /></p>
7
- <p><input type="submit" name="Submit" /></p>
8
- </form>
@@ -1,8 +0,0 @@
1
- <%= flash[:error] %>
2
- <%= flash[:notice] %>
3
- <form action="signup" method="post">
4
- <p>E-mail:<input type="text" name="email" /></p>
5
- <p>Password:<input type="password" name="password" /></p>
6
- <p>Confirm password:<input type="password" name="password_confirmation" /></p>
7
- <input type="submit" value="Register!" />
8
- </form>