admin_generator 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/admin_generator.rb +8 -1
- data/lib/admin_generator/version.rb +1 -1
- data/lib/templates/controllers/admin/{sessios_controller.rb → sessions_controller.rb} +4 -4
- data/lib/templates/views/admin/sessions/new.html.erb +2 -2
- data/lib/templates/views/layouts/admin/application.html.erb +14 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11ddec8c42e0decb5c696ac2d94ae6104144907b
|
4
|
+
data.tar.gz: b530fa086e7c1213dba28fe20b87961ef9df4c6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af01bf0fe2246a9bb808fa122487b76ff1ce7a206d104427a11b0b911883cbb06ce776fbd271ea93de3682697ca04ccac9f89967e67e60d6ca83f06e842a1ad9
|
7
|
+
data.tar.gz: 83d11b3368e5747622c55902231fc10de09406ca6c5a412acdbac9e65d167a58243901c5ce3152a44e59ab1b5e7e5b112b91402991de6cbe8f3ddef98a275507
|
data/lib/admin_generator.rb
CHANGED
@@ -14,7 +14,14 @@ module AdminGenerator
|
|
14
14
|
generate "sorcery:install"
|
15
15
|
generate "sorcery:install", "activity_logging brute_force_protection --only-submodules"
|
16
16
|
|
17
|
-
route
|
17
|
+
route <<-EOH
|
18
|
+
namespace :admin do
|
19
|
+
root 'home#index'
|
20
|
+
resource :sessions, only: %i(create)
|
21
|
+
get 'login' => 'sessions#new', as: :login
|
22
|
+
get 'logout' => 'sessions#destroy', as: :logout
|
23
|
+
end
|
24
|
+
EOH
|
18
25
|
end
|
19
26
|
end
|
20
27
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
class Admin::
|
2
|
-
|
3
|
-
before_action :login_required, only:
|
1
|
+
class Admin::SessionsController < Admin::BaseController
|
2
|
+
skip_before_action :login_required, only: %i(new create)
|
3
|
+
before_action :login_required, only: :destroy
|
4
4
|
|
5
5
|
def new
|
6
6
|
cookies.permanent[:admin] = true # analyticsの解析が入らないようにするやつ
|
@@ -19,6 +19,6 @@ class Admin::SettionsController < Admin::BaseController
|
|
19
19
|
|
20
20
|
def destroy
|
21
21
|
logout
|
22
|
-
redirect_to
|
22
|
+
redirect_to admin_root_url, notice: t('sign_out')
|
23
23
|
end
|
24
24
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<div class="span10">
|
2
2
|
<h1>管理者ログイン</h1>
|
3
|
-
<%= form_tag admin_sessions_path do %>
|
3
|
+
<%= form_tag admin_sessions_path, method: :post do %>
|
4
4
|
<div class="field">
|
5
5
|
<%= label_tag :username %>
|
6
6
|
<%= text_field_tag :username, params[:username] %>
|
@@ -13,6 +13,6 @@
|
|
13
13
|
<%= check_box_tag :remember_me, 1, params[:remember_me] %>
|
14
14
|
<%= label_tag :remember_me %>
|
15
15
|
</div>
|
16
|
-
<div class="actions"><%= submit_tag
|
16
|
+
<div class="actions"><%= submit_tag 'sign_in', class: 'btn btn-large btn-primary' %></div>
|
17
17
|
<% end %>
|
18
18
|
</div>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>PcKeyboardInfo</title>
|
5
|
+
<%= csrf_meta_tags %>
|
6
|
+
|
7
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
8
|
+
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
9
|
+
</head>
|
10
|
+
|
11
|
+
<body>
|
12
|
+
<%= yield %>
|
13
|
+
</body>
|
14
|
+
</html>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: admin_generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jiikko
|
@@ -74,9 +74,10 @@ files:
|
|
74
74
|
- lib/admin_generator/version.rb
|
75
75
|
- lib/templates/controllers/admin/base_controller.rb
|
76
76
|
- lib/templates/controllers/admin/home_controller.rb
|
77
|
-
- lib/templates/controllers/admin/
|
77
|
+
- lib/templates/controllers/admin/sessions_controller.rb
|
78
78
|
- lib/templates/views/admin/home/index.html.slim
|
79
79
|
- lib/templates/views/admin/sessions/new.html.erb
|
80
|
+
- lib/templates/views/layouts/admin/application.html.erb
|
80
81
|
homepage: https://github.com/jiikko/admin_generator
|
81
82
|
licenses:
|
82
83
|
- MIT
|