ecm_user_area2 1.2.6 → 1.2.8

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: 9635e24f9a824653acf3610b2f42cf217bdaa386
4
- data.tar.gz: 76ae0d36bd4fa4910c2c7a5d5d36784665760009
3
+ metadata.gz: f680be0d329033f349f7baf5a8ee7964642113a6
4
+ data.tar.gz: 80970f703a0fe7d61c2603f3afd52d48be9f0204
5
5
  SHA512:
6
- metadata.gz: dbec2012fa3c19cfc12c4e22fb7c60d9108fb2a9a17d628a1b3272a982c00a33d8906ee0d8a42bc7c9fca84ff701a2c2e5317d0e5900d1d4c985db5739d23b10
7
- data.tar.gz: b3e61cc87beac95f27fcee2325e3019f6eef8bba69448c78917a6c0b6578978a34dab051e79db42316adec0c6bccd4b389d12d8b06c26b101fb0c40a110c3c9c
6
+ metadata.gz: 29f98b6c1da172a227e8d4571f51e76356439402de0a998424ec20f2c49af3ea832512a511b507da1a923875293fd015b6fc93ff2c50e73100c2d7c524b0edf6
7
+ data.tar.gz: 6e26326247001a0c22cff3dc50677450e481ce398a7c1838dc13a2c038977c39c8d5f6799545dcf7c4969073dcdf34fe25df2612fc96e01b4641bd635781d809
@@ -23,7 +23,7 @@ module Controller
23
23
 
24
24
  def current_user_session
25
25
  return @current_user_session if defined?(@current_user_session)
26
- @current_user_session = Ecm::UserArea::UserSession.find
26
+ @current_user_session = ::Ecm::UserArea::UserSession.find
27
27
  end
28
28
 
29
29
  def current_user
@@ -42,14 +42,14 @@ module Ecm::UserArea
42
42
  private
43
43
 
44
44
  def after_sign_in_url
45
- defined?(super) ? super : "/#{I18n.locale}"
45
+ defined?(super) ? super : main_app.root_path
46
46
  end
47
47
 
48
48
  def permitted_params
49
49
  if Rails.version < '5'
50
50
  params.require(resource_class.name.demodulize.underscore.tr('/', '_')).permit(:email, :password)
51
51
  else
52
- params.require(resource_class.name.demodulize.underscore.tr('/', '_')).permit(:email, :password).to_hash
52
+ params.require(resource_class.name.demodulize.underscore.tr('/', '_')).permit(:email, :password).to_h
53
53
  end
54
54
  end
55
55
  end
@@ -4,8 +4,8 @@ module Ecm::UserArea
4
4
  class User < ActiveRecord::Base
5
5
  acts_as_authentic &Ecm::UserArea::Configuration.acts_as_authentic_options
6
6
 
7
- scope :autocomplete, ->(matcher) { where("LOWER(email) LIKE ?", "%#{matcher.downcase}%") }
8
-
7
+ scope :autocomplete, ->(matcher) { where("LOWER(email) LIKE ?", "%#{matcher.downcase}%") }
8
+ scope :authenticable, -> { where(active: true, confirmed: true, approved: true) }
9
9
  # def self.current_id=(id)
10
10
  # Thread.current[:user_id] = id
11
11
  # end
@@ -27,6 +27,10 @@ module Ecm::UserArea
27
27
  end
28
28
  end
29
29
 
30
+ def authenticable?
31
+ [active, confirmed, approved].all?
32
+ end
33
+
30
34
  def human
31
35
  email
32
36
  end
@@ -0,0 +1,32 @@
1
+ module Ecm::UserArea
2
+ module SpecHelpers
3
+ module Feature
4
+ def sign_up(user_attributes)
5
+ visit "/#{I18n.locale}/auth/user/new"
6
+
7
+ within('#new_user') do
8
+ fill_in 'user[email]', with: user_attributes[:email]
9
+ fill_in 'user[password]', with: user_attributes[:password]
10
+ fill_in 'user[password_confirmation]', with: user_attributes[:password]
11
+
12
+ click_on I18n.t('helpers.submit.user.create')
13
+ end
14
+ end
15
+
16
+ def sign_in(user)
17
+ visit "/#{I18n.locale}/auth/user_session/new"
18
+
19
+ within('#new_user_session') do
20
+ fill_in 'user_session[email]', with: user.email
21
+ fill_in 'user_session[password]', with: user.password
22
+
23
+ click_on I18n.t('helpers.submit.user_session.create')
24
+ end
25
+ # puts page.body
26
+ # expect(page.status_code).to eq(200)
27
+ # expect(current_path).to eq("/#{I18n.locale}/backend")
28
+ # expect(page.body).to have_text(I18n.t('messages.success.ecm_user_area.signed_in'))
29
+ end
30
+ end
31
+ end
32
+ end
@@ -1,5 +1,5 @@
1
1
  module Ecm
2
2
  module UserArea
3
- VERSION = '1.2.6'
3
+ VERSION = '1.2.8'
4
4
  end
5
5
  end
@@ -33,7 +33,7 @@ Ecm::UserArea.configure do |config|
33
33
  # config.login_field = :email
34
34
  # end
35
35
  #
36
- config.acts_as_authentic_options = ->(c) do
36
+ config.acts_as_authentic_options = lambda do |c|
37
37
  c.crypto_provider = Authlogic::CryptoProviders::BCrypt
38
38
  c.login_field = :email
39
39
  # How paranoid are you?
@@ -3,7 +3,13 @@
3
3
  FactoryGirl.define do
4
4
  factory :ecm_user_area_user, class: 'Ecm::UserArea::User' do
5
5
  sequence(:email) { |n| "user#{n}@example.com" }
6
- password 'password'
6
+ password 'password'
7
7
  password_confirmation 'password'
8
+
9
+ trait :authenticable do
10
+ active true
11
+ confirmed true
12
+ approved true
13
+ end
8
14
  end
9
15
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecm_user_area2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.6
4
+ version: 1.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Vasquez Angel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-23 00:00:00.000000000 Z
11
+ date: 2017-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -449,7 +449,7 @@ files:
449
449
  - db/migrate/20160115181043_create_ecm_user_area_users.rb
450
450
  - lib/ecm/user_area/configuration.rb
451
451
  - lib/ecm/user_area/engine.rb
452
- - lib/ecm/user_area/spec_helper.rb
452
+ - lib/ecm/user_area/spec_helpers/feature.rb
453
453
  - lib/ecm/user_area/version.rb
454
454
  - lib/ecm_user_area2.rb
455
455
  - lib/generators/ecm/user_area/install/install_generator.rb
@@ -1,24 +0,0 @@
1
- module Ecm::UserArea
2
- module SpecHelper
3
- def sign_up(user_attributes)
4
- visit '/de/auth/user/new'
5
-
6
- within('#new_user') do
7
- fill_in 'user[email]', with: user_attributes[:email]
8
- fill_in 'user[password]', with: user_attributes[:password]
9
- fill_in 'user[password_confirmation]', with: user_attributes[:password]
10
- click_on submit(:user, :create)
11
- end
12
- end
13
-
14
- def sign_in(user)
15
- visit '/de/auth/user_session/new'
16
-
17
- within('#new_user_session') do
18
- fill_in 'user_session[email]', with: user.email
19
- fill_in 'user_session[password]', with: 'password'
20
- click_on submit(:user_session, :create)
21
- end
22
- end
23
- end
24
- end