trestle-auth 0.2.1 → 0.2.2

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: f688a3e6ddfdb194c5d439d6dbd1d36c0da636d7
4
- data.tar.gz: d102f6ae10ac44258551d1cc0d0efb0fc06fb7db
3
+ metadata.gz: 526a5bb317d5e7a4cc86bfc4bf3f8cc7738711b5
4
+ data.tar.gz: 7e7ac41fbac4ab25372a076d22115d60ae5047cc
5
5
  SHA512:
6
- metadata.gz: c5ebdbca43f108eafb6d3e49b4702a87caa6c06f3f7aa51de9ceeadbed5b94ab6a1605f396ca2660121d1a78492d7787ca1a362e9091ede6f81cb7f6db6aa87a
7
- data.tar.gz: a52411f8cc84950aea12bdccb73ca6fccf8a28153d53a3402be0f80a11c54f90ab0d550480a235b0b70b8c44e0e243b4efa16cbe2d1c571c50e0f3004449739e
6
+ metadata.gz: 7d992286cb24a3876ba4f60e46d3a43b95f936fdfa955479544083b5684755c3ed23a3e8d3cc296a5db81bf78b3e3b078413f2fc59b88a78721e2930968111e4
7
+ data.tar.gz: eb1877b2b963f5351b1092e82f90a0de83efa1288adbf131fbc078391cf9fcbd1038642ebb450775d33bab07278c26ef6d16beabfe2c458ad04302c185b3201a
data/README.md CHANGED
@@ -21,7 +21,7 @@ Run `bundle install`, and then run the install generator to set up configuration
21
21
  Then create an initial admin user from the rails console:
22
22
 
23
23
  $ rails console
24
- > User.create(email: "admin@example.com", password: "password", first_name: "Admin", last_name: "User")
24
+ > Administrator.create(email: "admin@example.com", password: "password", first_name: "Admin", last_name: "User")
25
25
 
26
26
  After restarting your Rails server, any attempt to access a page within your admin will redirect you to the login page.
27
27
 
@@ -22,6 +22,10 @@ module Trestle
22
22
  )
23
23
  }
24
24
 
25
+ option :find_user, ->(id) {
26
+ Trestle.config.auth.user_scope.find_by(id: id)
27
+ }
28
+
25
29
  option :avatar, ->(user) {
26
30
  gravatar(user.email)
27
31
  }, evaluate: false
@@ -14,7 +14,7 @@ module Trestle
14
14
  def current_user
15
15
  @current_user ||= begin
16
16
  if session[:trestle_user]
17
- Trestle.config.auth.user_scope.find_by(id: session[:trestle_user])
17
+ Trestle.config.auth.find_user(session[:trestle_user])
18
18
  elsif Trestle.config.auth.remember.enabled && token = cookies.signed[:trestle_remember_token]
19
19
  user = Trestle.config.auth.remember.authenticate(token)
20
20
  login!(user) if user
@@ -3,7 +3,7 @@ module Trestle
3
3
  class Engine < ::Rails::Engine
4
4
  config.assets.precompile << "trestle/auth.css" << "trestle/auth.js" << "trestle/auth/userbox.scss"
5
5
 
6
- initializer "trestle.auth.helpers" do
6
+ config.before_initialize do
7
7
  Trestle::Engine.paths["app/helpers"].concat(paths["app/helpers"].existent)
8
8
  end
9
9
 
@@ -1,5 +1,5 @@
1
1
  module Trestle
2
2
  module Auth
3
- VERSION = "0.2.1"
3
+ VERSION = "0.2.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trestle-auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Pohlenz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-04 00:00:00.000000000 Z
11
+ date: 2017-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: trestle