defcon 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/defcon/sessions_controller.rb +8 -6
- data/app/views/defcon/sessions/new.html.erb +6 -3
- data/config/routes.rb +3 -4
- data/db/migrate/20141008214632_add_index_to_defcon_admin_users.rb +5 -0
- data/lib/defcon/version.rb +1 -1
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/schema.rb +3 -1
- data/test/dummy/log/development.log +16 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20bc5842476a4eb7364aed19bfe432bfd889455b
|
4
|
+
data.tar.gz: c929ad5de421b8f9e03417aefc9ebb554b982bb4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 579bf1bb18acc501f4bbccd0b7bd6280f0fc35618435222e005003c9ee84b4661077637d121bfeebac782f6e42c999e3157048c30858b2bdf8d21c5474a8cc32
|
7
|
+
data.tar.gz: 37b7174e4e21af37756a12bea39327822b55ff58f08d2ddfa6b3dd87b1c954ae9aec51ea46eae35cfbe2a9ae32116033a555960207de0a819c6f295256c4e31a
|
@@ -17,27 +17,29 @@ module Defcon
|
|
17
17
|
session[:admin_username] = admin.username
|
18
18
|
redirect_to admin_root_path, notice: "Welcome back!"
|
19
19
|
else
|
20
|
-
|
21
|
-
|
20
|
+
if !admin.nil?
|
21
|
+
admin.attempts = admin.attempts + 1
|
22
|
+
admin.save
|
23
|
+
end
|
22
24
|
message = "Are you sure you belong here?"
|
23
|
-
if admin.locked_out?
|
25
|
+
if !admin.nil? && admin.locked_out?
|
24
26
|
message = "Locked out!"
|
25
27
|
end
|
26
|
-
redirect_to
|
28
|
+
redirect_to defcon_login_path, alert: message
|
27
29
|
end
|
28
30
|
end
|
29
31
|
|
30
32
|
def destroy
|
31
33
|
session[:admin_id] = nil
|
32
34
|
session[:admin_username] = nil
|
33
|
-
redirect_to
|
35
|
+
redirect_to defcon_login_path, notice: "Until next time!"
|
34
36
|
end
|
35
37
|
|
36
38
|
private
|
37
39
|
|
38
40
|
def logged_in_check
|
39
41
|
if !logged_in?
|
40
|
-
redirect_to
|
42
|
+
redirect_to defcon_login_path, alert: "You are not logged in."
|
41
43
|
return false
|
42
44
|
else
|
43
45
|
return true
|
@@ -1,4 +1,6 @@
|
|
1
|
-
<
|
1
|
+
<div class="text-center">
|
2
|
+
<h1>Admin</h1>
|
3
|
+
</div>
|
2
4
|
|
3
5
|
<div class="text-center">
|
4
6
|
<% flash.each do |name, msg| -%>
|
@@ -28,5 +30,6 @@
|
|
28
30
|
<br>
|
29
31
|
<div class="actions"><%= submit_tag("Login", class: "btn btn-large btn-primary") %></div>
|
30
32
|
</div>
|
31
|
-
|
32
|
-
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<% end %>
|
data/config/routes.rb
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
Defcon::Engine.routes.draw do
|
2
|
-
|
3
|
-
get 'admin/login' => "sessions#new", as: '
|
2
|
+
root to: "sessions#new"
|
3
|
+
get 'admin/login' => "sessions#new", as: 'defcon_login'
|
4
4
|
post 'sessions/create'
|
5
5
|
post 'sessions/destroy'
|
6
|
-
post 'admin/logout' => "sessions#destroy", as: '
|
6
|
+
post 'admin/logout' => "sessions#destroy", as: 'defcon_logout'
|
7
7
|
#This get is only here for convenience
|
8
8
|
#get 'admin/logout' => "sessions#destroy"
|
9
9
|
#Need to define an admin_root_path if not using active admin
|
10
|
-
|
11
10
|
end
|
data/lib/defcon/version.rb
CHANGED
Binary file
|
data/test/dummy/db/schema.rb
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended that you check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(version:
|
14
|
+
ActiveRecord::Schema.define(version: 20141008214632) do
|
15
15
|
|
16
16
|
create_table "defcon_admin_users", force: true do |t|
|
17
17
|
t.string "username"
|
@@ -25,4 +25,6 @@ ActiveRecord::Schema.define(version: 20141008173352) do
|
|
25
25
|
t.datetime "updated_at"
|
26
26
|
end
|
27
27
|
|
28
|
+
add_index "defcon_admin_users", ["username"], name: "index_defcon_admin_users_on_username"
|
29
|
+
|
28
30
|
end
|
@@ -8,3 +8,19 @@ Migrating to CreateDefconAdminUsers (20141008173352)
|
|
8
8
|
[1m[36mSQL (0.5ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20141008173352"]]
|
9
9
|
[1m[35m (140.4ms)[0m commit transaction
|
10
10
|
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
11
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
12
|
+
Migrating to AddIndexToDefconAdminUsers (20141008214632)
|
13
|
+
[1m[35m (0.1ms)[0m begin transaction
|
14
|
+
[1m[36m (0.1ms)[0m [1mselect sqlite_version(*)[0m
|
15
|
+
[1m[35m (23.7ms)[0m CREATE INDEX "index_defcon_admin_users_on_username" ON "defcon_admin_users" ("username")
|
16
|
+
[1m[36mSQL (0.6ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20141008214632"]]
|
17
|
+
[1m[35m (510.7ms)[0m commit transaction
|
18
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
19
|
+
[1m[35m (0.2ms)[0m SELECT sql
|
20
|
+
FROM sqlite_master
|
21
|
+
WHERE name='index_defcon_admin_users_on_username' AND type='index'
|
22
|
+
UNION ALL
|
23
|
+
SELECT sql
|
24
|
+
FROM sqlite_temp_master
|
25
|
+
WHERE name='index_defcon_admin_users_on_username' AND type='index'
|
26
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: defcon
|
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
|
- Cleophus Robinson
|
@@ -61,6 +61,7 @@ files:
|
|
61
61
|
- app/views/layouts/defcon/default/application.html.erb
|
62
62
|
- config/routes.rb
|
63
63
|
- db/migrate/20141008173352_create_defcon_admin_users.rb
|
64
|
+
- db/migrate/20141008214632_add_index_to_defcon_admin_users.rb
|
64
65
|
- lib/defcon.rb
|
65
66
|
- lib/defcon/engine.rb
|
66
67
|
- lib/defcon/version.rb
|