jt-rails-generator-user 1.0.6 → 1.0.7

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: f34a1b854f33a7b750bbb2b710e9a919cf6c227d
4
- data.tar.gz: c782887d8f0251e309c319ad0ae909b775ad9954
3
+ metadata.gz: b928701c4ec419cec4da575a2d48d40b8a4b2806
4
+ data.tar.gz: 13f58534e06736f99a5ea03622328fba62afe2e1
5
5
  SHA512:
6
- metadata.gz: b40630ccba57c63335052cb99dd3e7911c680e09190a31af490b7c55d67bc506ee5a74e4f36f837dad0808813f61935b067473b10620994d3def201622cdf390
7
- data.tar.gz: 7c644a85299559db59c402b7c2e958ad8db494b216a90c49253bb61500718b1fe8689f9aea864dccb1f30b62b04529e72c164ea123218f1a438a2a58d7d4a336
6
+ metadata.gz: d5560f093f6d79322601b68f58165d0bb05355d3c3d017cc4559d59da13e8a17643b801d898e6f349c60bac3242fe8422d10f638b33f53a98cd3ec9345b723b5
7
+ data.tar.gz: 5c38d45a2b3af0bb299117dc2280c3804d12251283cfddf1aa21814c4d4c346ccedb2caf14d31a59e3f3660da7a6ff51606d4ca364441028cff15a033cdf5c45
@@ -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'
6
+ s.version = '1.0.7'
7
7
  s.files = `git ls-files`.split("\n")
8
8
  s.require_paths = ['lib']
9
9
  s.authors = ['Jonathan TRIBOUHARET']
@@ -18,13 +18,17 @@ module CurrentUser
18
18
  def require_user
19
19
  if !current_user
20
20
  redirect_to login_url
21
+ return false
21
22
  end
23
+ true
22
24
  end
23
25
 
24
26
  def require_no_user
25
27
  if current_user
26
28
  redirect_to root_url
29
+ return false
27
30
  end
28
- end
31
+ true
32
+ end
29
33
 
30
34
  end
@@ -1,4 +1,4 @@
1
- class UserMailer < ApplicationMailer
1
+ class UserMailer < ActionMailer::Base
2
2
 
3
3
  def reset_password(user_id)
4
4
  @user = User.find(user_id)
@@ -11,7 +11,8 @@ module UserAuthentication
11
11
 
12
12
  before_save :downcase_email
13
13
 
14
- scope :search_by_email_for_authentication, ->(email = nil) { where(email: email.to_s.downcase).where('password_digest IS NOT NULL') }
14
+ scope :search_by_email, ->(email) { where(email: email.to_s.downcase) }
15
+ scope :search_by_email_for_authentication, ->(email) { search_by_email(email).where('password_digest IS NOT NULL') }
15
16
 
16
17
  end
17
18
 
@@ -13,8 +13,7 @@ module Jt
13
13
 
14
14
  route "resources :users, only: [:new, :create] do
15
15
  collection do
16
- get 'password_forgot' => 'users#password_forgot', as: :password_forgot
17
- post 'password_forgot' => 'users#password_forgot'
16
+ match 'password_forgot', as: :password_forgot, via: [:get, :post]
18
17
 
19
18
  get 'reset_password/:token' => 'users#reset_password', as: :reset_password
20
19
  end
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.6
4
+ version: 1.0.7
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-17 00:00:00.000000000 Z
11
+ date: 2015-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: validates_email_format_of