authem 1.3.3 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4ab055d04dcac03a2274070a9d943c0b620ef7e6
4
- data.tar.gz: 16d4f50e769a947afaac241902d96dfb05df21bd
3
+ metadata.gz: dfadf2e98145044611efbc8cf9c464bf61ff5a4a
4
+ data.tar.gz: 7711f61516b8011719f3bef3227db9a6c2d69a07
5
5
  SHA512:
6
- metadata.gz: 80ad4b4c249a683e09b44989725526e800c888462c381b8b5368e0da5b5d9c1a6006bae73995adf60c2dbbb3cefb1d1011da0f1314e170e8f0043f4ea8cce6a5
7
- data.tar.gz: 449edac32576e9daca22f3597798f94a534c6ee6a7db792814564d03d3fbab6254971f6d31feaa32080ac8e9a61dc8416f6849e44cf4b1d0d4af34a16243bb45
6
+ metadata.gz: c1645715ffabda3d2ccc4a246e2e1bfd8b7e84fee7fada613bf2960718a1948d3b69e42f6507b8a48a16c482a5f9ff6f3d99c7276197638325c5505a29786cf1
7
+ data.tar.gz: 4525dcad2f1a248e498e62447b6bc622a022ec30cfe428bd1d20a41cd35c79337f0cf249e184405caa03e2a33faa6bbb0b8aae5d9130d10607ef219bf0757a8f
@@ -1,11 +1,10 @@
1
1
  module Authem
2
- autoload :BaseUser, 'authem/base_user'
3
- autoload :User, 'authem/user'
4
- autoload :SorceryUser, 'authem/sorcery_user'
5
-
6
- autoload :Config, 'authem/config'
2
+ autoload :BaseUser, 'authem/base_user'
3
+ autoload :User, 'authem/user'
4
+ autoload :SorceryUser, 'authem/sorcery_user'
5
+ autoload :Config, 'authem/config'
7
6
  autoload :ControllerSupport, 'authem/controller_support'
8
- autoload :Token, 'authem/token'
7
+ autoload :Token, 'authem/token'
9
8
 
10
9
  def self.configure(&block)
11
10
  Config.configure(&block)
@@ -22,7 +22,7 @@ module Authem::BaseUser
22
22
 
23
23
  def reset_password(password, confirmation)
24
24
  if password.blank?
25
- self.errors.add(:password, :blank)
25
+ self.errors.add :password, :blank
26
26
  return false
27
27
  end
28
28
 
@@ -32,20 +32,18 @@ module Authem::BaseUser
32
32
  self.password_confirmation = confirmation
33
33
  self.reset_password_token = nil
34
34
 
35
- if save
36
- true
37
- else
38
- self.reset_password_token = reset_password_token
39
- false
40
- end
35
+ return true if save
36
+
37
+ self.reset_password_token = reset_password_token
38
+ false
41
39
  end
42
40
 
43
41
  def reset_password_token!
44
- generate_token(:reset_password)
42
+ generate_token :reset_password
45
43
  end
46
44
 
47
45
  def reset_session_token!
48
- generate_token(:session)
46
+ generate_token :session
49
47
  end
50
48
 
51
49
  private
@@ -40,7 +40,7 @@ module Authem::ControllerSupport
40
40
  def redirect_back_or_to(url, flash_hash = {})
41
41
  url = session[:return_to_url] || url
42
42
  session[:return_to_url] = nil
43
- redirect_to(url, :flash => flash_hash)
43
+ redirect_to url, flash: flash_hash
44
44
  end
45
45
 
46
46
  included do
@@ -5,8 +5,8 @@ module Authem::SorceryUser
5
5
  included do
6
6
  attr_accessor :password, :password_confirmation
7
7
  validates_presence_of :password, on: :create
8
- validates_presence_of :password_confirmation, if: ->(user) { user.password.present? }
9
- validates_confirmation_of :password, if: ->(user) { user.password.present? }
8
+ validates_presence_of :password_confirmation, if: ->{ password.present? }
9
+ validates_confirmation_of :password, if: ->{ password.present? }
10
10
 
11
11
  before_save :encrypt_password
12
12
  end
@@ -1,7 +1,7 @@
1
- class Authem::Token
1
+ require 'securerandom'
2
2
 
3
+ class Authem::Token
3
4
  def self.generate
4
- Digest::SHA1.hexdigest(Time.now.to_s.split(//).sort_by {rand}.join)
5
+ SecureRandom.hex(20)
5
6
  end
6
-
7
7
  end
@@ -1,3 +1,3 @@
1
1
  module Authem
2
- VERSION = '1.3.3'
2
+ VERSION = '1.4.0'.freeze
3
3
  end
@@ -6,7 +6,7 @@ module Authem
6
6
  argument :model_name, type: :string, default: "user"
7
7
 
8
8
  def generate_model
9
- generate("model #{model_name} email:string password_digest:string reset_password_token:string session_token:string remember_token:string")
9
+ generate "model #{model_name} email:string password_digest:string reset_password_token:string session_token:string remember_token:string"
10
10
  end
11
11
 
12
12
  def update_model_to_include_authem
@@ -15,7 +15,7 @@ module Authem
15
15
 
16
16
  def add_initializer
17
17
  create_file 'config/initializers/authem.rb' do
18
- %Q(Authem.configure do |config|\n config.user_class = #{model_name.camelize}\nend)
18
+ "Authem.configure do |config|\n config.user_class = #{model_name.camelize}\nend"
19
19
  end
20
20
  end
21
21
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authem
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.3
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Elliott
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-04 00:00:00.000000000 Z
11
+ date: 2013-12-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -109,7 +109,7 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: pg
112
+ name: sqlite3
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - '>='
@@ -167,7 +167,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
167
167
  requirements:
168
168
  - - '>='
169
169
  - !ruby/object:Gem::Version
170
- version: '0'
170
+ version: 1.9.3
171
171
  required_rubygems_version: !ruby/object:Gem::Requirement
172
172
  requirements:
173
173
  - - '>='