rails_jwt_admin 0.1.0 → 0.1.5

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
  SHA256:
3
- metadata.gz: fa0138f72063844bfe41d165ae7e9f767f05ac7ba449101e83f2b833d524026e
4
- data.tar.gz: 9c9300c0eac1f2d816ca28dbae9bb77e6d6557a26716b924040c343a8e000832
3
+ metadata.gz: cea14329748e5f97b29a967644804f20bd8e0f4f60f7b963bc7a3c74f54abaae
4
+ data.tar.gz: 825d36984443e9279231464d349b51235c4bc2c7c6b50aa2182450a049d0dfc1
5
5
  SHA512:
6
- metadata.gz: bdd8f063c72799549be709f767c2b5b8adfa4669fa8ed59a660209238097e0e0fa417ccef57fbffaea41772baf3a9de2e52305a8927e50eed54af20cb99e00e2
7
- data.tar.gz: c051482415d9200d3ac53d3942e4fcd468bc8fe8c5632b0b5391d8d9c393561783926476a9322da5505fa490427f71613bff8d511549f21fe6923e82d2a5c3ba
6
+ metadata.gz: 952e84d9bfbdf0a7def0d1fbaf6ddcf9cf57a21e1e96cdb971bcedf49140f22a6fa5f3bc9e9b79290e1318f560ad60618b396a1ef941c7c4094963b27a6461d5
7
+ data.tar.gz: 4f3cdfccb963bf566902c9f56e8b6d085b2e646ed429eed09c13c1a9ed10462fd7b9cb691cf10e80f706cc9abe394146096c2164825c62ae951e16a88b6da7d6
data/README.md CHANGED
@@ -3,11 +3,24 @@
3
3
 
4
4
  ## installation
5
5
  ```shell
6
- # gem
7
- gem install 'rails_jwt_admin'
8
-
9
- # rails - bundle install
6
+ # 1. add gen & bundle install
10
7
  gem 'rails_jwt_admin'
8
+
9
+ # 2. install admin
10
+ rails g rails_jwt_admin:install
11
+
12
+ # 3. check table & rake db:migrate
13
+ rake db:migrate
14
+ ```
15
+
16
+ ## seed
17
+ ```rb
18
+ RailsJwtAdmin::User.create(
19
+ username: "admin",
20
+ email: "example@qq.com",
21
+ password: "123123",
22
+ password_confirmation: "123123"
23
+ )
11
24
  ```
12
25
 
13
26
  ## resources
@@ -16,4 +29,5 @@ gem 'rails_jwt_admin'
16
29
  - https://www.jianshu.com/p/56467f890516
17
30
  - https://www.pluralsight.com/guides/token-based-authentication-with-ruby-on-rails-5-api
18
31
  - https://github.com/jwt/ruby-jwt
19
- - https://github.com/afeiship/rails-module-jwt
32
+ - https://github.com/afeiship/rails-module-jwt
33
+ - https://github.com/afeiship/rails_admin_users
@@ -2,6 +2,8 @@ module RailsJwtAdmin
2
2
  class User < ApplicationRecord
3
3
  has_secure_password
4
4
 
5
+ validates_uniqueness_of :username, :email
6
+
5
7
  def token
6
8
  { token: Token.encode(user_id: self.id) }
7
9
  end
@@ -0,0 +1,18 @@
1
+ module RailsJwtAdmin
2
+ class InstallGenerator < Rails::Generators::Base
3
+ desc "Configure necessary files to use RailsJwtAdmin"
4
+
5
+ def generate_model
6
+ rake "rails_jwt_admin:install:migrations"
7
+ end
8
+
9
+ def create_routes
10
+ route 'mount RailsJwtAdmin::Engine => "/rails_jwt_admin"'
11
+ end
12
+
13
+ def add_gems
14
+ gem "jwt"
15
+ gem "bcrypt"
16
+ end
17
+ end
18
+ end
@@ -2,6 +2,5 @@ module RailsJwtAdmin
2
2
  class Engine < ::Rails::Engine
3
3
  isolate_namespace RailsJwtAdmin
4
4
  config.generators.api_only = true
5
- config.autoload_paths += Dir["#{config.root}/lib/vendors"]
6
5
  end
7
6
  end
@@ -1,3 +1,3 @@
1
1
  module RailsJwtAdmin
2
- VERSION = '0.1.0'
2
+ VERSION = "0.1.5"
3
3
  end
@@ -1,4 +1,5 @@
1
1
  require "rails_jwt_admin/engine"
2
+ require "vendors/token.rb"
2
3
 
3
4
  module RailsJwtAdmin
4
5
  # Your code goes here...
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_jwt_admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - afeiship
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-02 00:00:00.000000000 Z
11
+ date: 2021-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -44,7 +44,7 @@ dependencies:
44
44
  - - ">="
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0'
47
- description:
47
+ description:
48
48
  email:
49
49
  - 1290657123@qq.com
50
50
  executables: []
@@ -61,6 +61,7 @@ files:
61
61
  - app/models/rails_jwt_admin/user.rb
62
62
  - config/routes.rb
63
63
  - db/migrate/20201202013006_create_rails_jwt_admin_users.rb
64
+ - lib/generators/rails_jwt_admin/install_generator.rb
64
65
  - lib/rails_jwt_admin.rb
65
66
  - lib/rails_jwt_admin/engine.rb
66
67
  - lib/rails_jwt_admin/version.rb
@@ -70,7 +71,7 @@ homepage: https://github.com/afeiship/rails_jwt_admin
70
71
  licenses:
71
72
  - MIT
72
73
  metadata: {}
73
- post_install_message:
74
+ post_install_message:
74
75
  rdoc_options: []
75
76
  require_paths:
76
77
  - lib
@@ -86,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
87
  version: '0'
87
88
  requirements: []
88
89
  rubygems_version: 3.0.3
89
- signing_key:
90
+ signing_key:
90
91
  specification_version: 4
91
92
  summary: Summary of RailsJwtAdmin.
92
93
  test_files: []