tramway-auth 1.0 → 1.0.1

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
  SHA256:
3
- metadata.gz: 0b893b1a2ffd4f17ca07c63ee4abad90318e723c0764e7cba1a32f258fbd50a3
4
- data.tar.gz: d13036bd0ffa66db9bd39352a6a148bd99a314d747b29c5ee4c2119f251e155b
3
+ metadata.gz: a5984e1c2e4e4d09c13f9c0089882b1c9b482d44ef64677428f778a5d1a10a07
4
+ data.tar.gz: a55bc79ce4b036f279af3d000fa584c0ad7b899714ba983b945cc6bb4958049d
5
5
  SHA512:
6
- metadata.gz: bfce2aa7edf2cb42b98874c3e034c632f307aee546835653183495f05894d825bd5a3b7993b1de0466aaba1a79843cfe2b040ddcd68be061fde8c1b631cd8dbc
7
- data.tar.gz: 0e8158fd812736b983f440ee20e97bdac54d828635336ef3d1773d45a090157f8e9720c5482603441e67d9fdbb7a1c69aa433c3562d391ffa3805660d4968c4b
6
+ metadata.gz: c19b6bb9e9620856a11624ce25bd48ebc42de1e6cf6013bcd1c5da5168200d2cb63337b8804fed1c770d47151595a02eae9d60cc9eb483fa89c2b3e4f5dbfc59
7
+ data.tar.gz: 56aa7895c55b24c05e6d9118185b5e505f9189ebdcef0dfdf104d7cb8653a35ec5a4dd1e5651083858c55af6c4c8da802d9d4318eb0233d4f1751c79b0884798
@@ -19,7 +19,7 @@ module Tramway::Auth
19
19
 
20
20
  def destroy
21
21
  sign_out
22
- redirect_to root_path
22
+ redirect_to ::Tramway::Auth.root_path
23
23
  end
24
24
 
25
25
  private
@@ -8,7 +8,18 @@ module Tramway::Auth
8
8
  end
9
9
 
10
10
  def validate(params)
11
- self.model.authenticate params[:password]
11
+ begin
12
+ add_wrong_email_or_password_error unless self.model.authenticate params[:password]
13
+ rescue
14
+ add_wrong_email_or_password_error
15
+ false
16
+ end
17
+ end
18
+
19
+ private
20
+
21
+ def add_wrong_email_or_password_error
22
+ errors.add(:email, I18n.t('errors.wrong_email_or_password'))
12
23
  end
13
24
  end
14
25
  end
@@ -5,3 +5,5 @@ ru:
5
5
  sessions:
6
6
  new:
7
7
  title: Авторизация
8
+ errors:
9
+ wrong_email_or_password: Неверный логин или пароль
@@ -1,5 +1,5 @@
1
1
  module Tramway
2
2
  module Auth
3
- VERSION = '1.0'
3
+ VERSION = '1.0.1'
4
4
  end
5
5
  end
data/lib/tramway/auth.rb CHANGED
@@ -3,6 +3,19 @@ require "tramway/auth/engine"
3
3
  module Tramway
4
4
  module Auth
5
5
  class << self
6
+ def authenticable_classes
7
+ @authenticable_classes ||= []
8
+ end
9
+
10
+ def authenticable_classes=(value)
11
+ @authenticable_classes ||= []
12
+ if value.is_a? Array
13
+ @authenticable_classes += value
14
+ else
15
+ @authenticable_classes << value
16
+ end
17
+ end
18
+
6
19
  def root
7
20
  File.dirname __dir__
8
21
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tramway-auth
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.0'
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Kalashnikov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-04 00:00:00.000000000 Z
11
+ date: 2019-05-29 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Rails engine for auth
14
14
  email: