kryptonite 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/MIT-LICENSE +20 -0
- data/PUBLIC_VERSION.yml +4 -0
- data/README.rdoc +209 -0
- data/Rakefile +40 -0
- data/app/controllers/kryptonite/kryptonite_controller.rb +72 -0
- data/app/controllers/kryptonite/password_resets_controller.rb +66 -0
- data/app/controllers/kryptonite/user_sessions_controller.rb +40 -0
- data/app/controllers/kryptonite/users_controller.rb +102 -0
- data/app/helpers/kryptonite/kryptonite_helper.rb +200 -0
- data/app/mailers/kryptonite/kryptonite_notification.rb +39 -0
- data/app/models/kryptonite/user.rb +55 -0
- data/app/models/kryptonite/user_session.rb +8 -0
- data/app/views/kryptonite/kryptonite/blank.html.erb +1 -0
- data/app/views/kryptonite/kryptonite_notification/generate_new_password.erb +12 -0
- data/app/views/kryptonite/kryptonite_notification/new_user_information.erb +12 -0
- data/app/views/kryptonite/kryptonite_notification/password_reset_instructions.erb +11 -0
- data/app/views/kryptonite/password_resets/edit.html.erb +48 -0
- data/app/views/kryptonite/user_sessions/new.html.erb +66 -0
- data/app/views/kryptonite/users/index.html.erb +35 -0
- data/app/views/kryptonite/users/new.html.erb +46 -0
- data/app/views/kryptonite/users/show.html.erb +94 -0
- data/app/views/layouts/kryptonite_auth.html.erb +24 -0
- data/app/views/layouts/kryptonite_main.html.erb +67 -0
- data/config/routes.rb +20 -0
- data/lib/generators/kryptonite/install/USAGE +1 -0
- data/lib/generators/kryptonite/install/install_generator.rb +37 -0
- data/lib/generators/kryptonite/install/templates/app/helpers/kryptonite/config_helper.rb +46 -0
- data/lib/generators/kryptonite/install/templates/app/views/kryptonite/layouts/_left_navigation.html.erb +2 -0
- data/lib/generators/kryptonite/install/templates/app/views/kryptonite/layouts/_right_navigation.html.erb +1 -0
- data/lib/generators/kryptonite/install/templates/db/migrate/kryptonite_create_users.rb +30 -0
- data/lib/generators/kryptonite/install/templates/public/casein/javascripts/custom.js +2 -0
- data/lib/generators/kryptonite/install/templates/public/casein/stylesheets/custom.css +2 -0
- data/lib/generators/kryptonite/install/templates/public/robots.txt +5 -0
- data/lib/generators/kryptonite/scaffold/USAGE +1 -0
- data/lib/generators/kryptonite/scaffold/scaffold_generator.rb +99 -0
- data/lib/generators/kryptonite/scaffold/templates/controller.rb +60 -0
- data/lib/generators/kryptonite/scaffold/templates/migration.rb +13 -0
- data/lib/generators/kryptonite/scaffold/templates/model.rb +3 -0
- data/lib/generators/kryptonite/scaffold/templates/views/_form.html.erb +9 -0
- data/lib/generators/kryptonite/scaffold/templates/views/_table.html.erb +17 -0
- data/lib/generators/kryptonite/scaffold/templates/views/index.html.erb +11 -0
- data/lib/generators/kryptonite/scaffold/templates/views/new.html.erb +18 -0
- data/lib/generators/kryptonite/scaffold/templates/views/show.html.erb +18 -0
- data/lib/generators/kryptonite/update/USAGE +1 -0
- data/lib/generators/kryptonite/update/templates/public/kryptonite/images/casein.png +0 -0
- data/lib/generators/kryptonite/update/templates/public/kryptonite/images/header.png +0 -0
- data/lib/generators/kryptonite/update/templates/public/kryptonite/images/icons/add.png +0 -0
- data/lib/generators/kryptonite/update/templates/public/kryptonite/images/icons/delete.png +0 -0
- data/lib/generators/kryptonite/update/templates/public/kryptonite/images/icons/table.png +0 -0
- data/lib/generators/kryptonite/update/templates/public/kryptonite/images/login/alertBg.png +0 -0
- data/lib/generators/kryptonite/update/templates/public/kryptonite/images/login/background.png +0 -0
- data/lib/generators/kryptonite/update/templates/public/kryptonite/images/login/bottom.png +0 -0
- data/lib/generators/kryptonite/update/templates/public/kryptonite/images/login/loginBoxBg.png +0 -0
- data/lib/generators/kryptonite/update/templates/public/kryptonite/images/login/loginBoxBottom.png +0 -0
- data/lib/generators/kryptonite/update/templates/public/kryptonite/images/login/loginBoxTop.png +0 -0
- data/lib/generators/kryptonite/update/templates/public/kryptonite/images/login/loginSubmit.png +0 -0
- data/lib/generators/kryptonite/update/templates/public/kryptonite/images/login/recoverSubmit.png +0 -0
- data/lib/generators/kryptonite/update/templates/public/kryptonite/images/login/top.png +0 -0
- data/lib/generators/kryptonite/update/templates/public/kryptonite/images/nav.png +0 -0
- data/lib/generators/kryptonite/update/templates/public/kryptonite/images/rightNav.png +0 -0
- data/lib/generators/kryptonite/update/templates/public/kryptonite/images/rightNavButton.png +0 -0
- data/lib/generators/kryptonite/update/templates/public/kryptonite/images/visitSiteNav.png +0 -0
- data/lib/generators/kryptonite/update/templates/public/kryptonite/javascripts/jquery.js +154 -0
- data/lib/generators/kryptonite/update/templates/public/kryptonite/javascripts/kryptonite.js +25 -0
- data/lib/generators/kryptonite/update/templates/public/kryptonite/javascripts/login.js +24 -0
- data/lib/generators/kryptonite/update/templates/public/kryptonite/javascripts/rails.js +132 -0
- data/lib/generators/kryptonite/update/templates/public/kryptonite/stylesheets/elements.css +307 -0
- data/lib/generators/kryptonite/update/templates/public/kryptonite/stylesheets/login.css +137 -0
- data/lib/generators/kryptonite/update/templates/public/kryptonite/stylesheets/screen.css +224 -0
- data/lib/generators/kryptonite/update/update_generator.rb +40 -0
- data/lib/kryptonite.rb +3 -0
- data/lib/kryptonite/engine.rb +22 -0
- data/lib/railties/tasks.rake +31 -0
- metadata +169 -0
@@ -0,0 +1,137 @@
|
|
1
|
+
/* KRYPTONITE LOGIN */
|
2
|
+
|
3
|
+
* {
|
4
|
+
margin: 0;
|
5
|
+
padding: 0;
|
6
|
+
}
|
7
|
+
|
8
|
+
body {
|
9
|
+
background: #efefef;
|
10
|
+
text-align: center;
|
11
|
+
font-family: "Lucida Grande", "Trebuchet MS", Helvetica, Arial, sans-serif;
|
12
|
+
}
|
13
|
+
|
14
|
+
a {
|
15
|
+
outline: none;
|
16
|
+
}
|
17
|
+
|
18
|
+
#header {
|
19
|
+
background: #efefef url(/kryptonite/images/login/top.png) repeat-x bottom left;
|
20
|
+
padding: 80px 0 40px 0;
|
21
|
+
}
|
22
|
+
|
23
|
+
#header h1 a img {
|
24
|
+
border: 0;
|
25
|
+
}
|
26
|
+
|
27
|
+
#header h1 a {
|
28
|
+
display: block;
|
29
|
+
width: 230px;
|
30
|
+
height: 33px;
|
31
|
+
margin: 0 auto;
|
32
|
+
}
|
33
|
+
|
34
|
+
#content {
|
35
|
+
background: #fff url(/kryptonite/images/login/bottom.png) repeat-x bottom left;
|
36
|
+
padding: 70px 0;
|
37
|
+
}
|
38
|
+
|
39
|
+
#content label {
|
40
|
+
display: block;
|
41
|
+
font-size: 12px;
|
42
|
+
padding: 0 0 5px 0;
|
43
|
+
color: #444;
|
44
|
+
}
|
45
|
+
|
46
|
+
#content .text {
|
47
|
+
width: 318px;
|
48
|
+
margin: 0 auto;
|
49
|
+
text-align: left;
|
50
|
+
}
|
51
|
+
|
52
|
+
#content .text h3 {
|
53
|
+
color: #444;
|
54
|
+
font-size: 12px;
|
55
|
+
margin: 0 0 5px 0;
|
56
|
+
text-align: left;
|
57
|
+
}
|
58
|
+
|
59
|
+
#content .kryptoniteTextField {
|
60
|
+
width: 292px;
|
61
|
+
padding: 8px 12px 7px 12px;
|
62
|
+
background: #efefef;
|
63
|
+
margin: 0 0 5px 0;
|
64
|
+
}
|
65
|
+
|
66
|
+
#content .submit_remember {
|
67
|
+
width: 318px;
|
68
|
+
text-align: left;
|
69
|
+
margin: 10px auto 0 auto;
|
70
|
+
font-size: 11px;
|
71
|
+
color: #444;
|
72
|
+
}
|
73
|
+
|
74
|
+
#content .kryptoniteSubmit {
|
75
|
+
background: #338018;
|
76
|
+
border: medium none;
|
77
|
+
color: #fff;
|
78
|
+
font-size: 10px;
|
79
|
+
padding: 4px 5px 5px 5px;
|
80
|
+
cursor: pointer;
|
81
|
+
}
|
82
|
+
|
83
|
+
#content .kryptoniteSubmit:hover {
|
84
|
+
background: #4ebf26;
|
85
|
+
}
|
86
|
+
|
87
|
+
#content .kryptoniteSubmitBlue {
|
88
|
+
background: #5990CE;
|
89
|
+
border: medium none;
|
90
|
+
color: #fff;
|
91
|
+
font-size: 10px;
|
92
|
+
padding: 4px 5px 5px 5px;
|
93
|
+
cursor: pointer;
|
94
|
+
}
|
95
|
+
|
96
|
+
#content .kryptoniteSubmitBlue:hover {
|
97
|
+
background: #71b4ff;
|
98
|
+
}
|
99
|
+
|
100
|
+
#content .error {
|
101
|
+
height: auto;
|
102
|
+
font-size: 11px;
|
103
|
+
color: #c30;
|
104
|
+
width: 318px;
|
105
|
+
text-align: center;
|
106
|
+
margin: 0 auto 10px auto;
|
107
|
+
}
|
108
|
+
|
109
|
+
#content .notice {
|
110
|
+
height: auto;
|
111
|
+
font-size: 11px;
|
112
|
+
color: green;
|
113
|
+
width: 318px;
|
114
|
+
text-align: center;
|
115
|
+
margin: 0 auto 10px auto;
|
116
|
+
}
|
117
|
+
|
118
|
+
#recover {
|
119
|
+
padding: 30px 0 0 0;
|
120
|
+
display: none;
|
121
|
+
}
|
122
|
+
|
123
|
+
#footer {
|
124
|
+
padding: 25px;
|
125
|
+
font-size: 11px;
|
126
|
+
color: #555;
|
127
|
+
}
|
128
|
+
|
129
|
+
#footer a {
|
130
|
+
font-size: 11px;
|
131
|
+
color: #4d8bb3;
|
132
|
+
text-decoration: none;
|
133
|
+
}
|
134
|
+
|
135
|
+
#footer a:hover {
|
136
|
+
color: #222;
|
137
|
+
}
|
@@ -0,0 +1,224 @@
|
|
1
|
+
/* KRYPTONITE */
|
2
|
+
|
3
|
+
/* GENERAL */
|
4
|
+
|
5
|
+
* {
|
6
|
+
margin: 0;
|
7
|
+
padding: 0;
|
8
|
+
}
|
9
|
+
|
10
|
+
body {
|
11
|
+
height: 100%;
|
12
|
+
max-height: 100%;
|
13
|
+
overflow: hidden;
|
14
|
+
background: white;
|
15
|
+
color: black;
|
16
|
+
font-family: "Lucida Grande", "Trebuchet MS", Helvetica, Arial, sans-serif;
|
17
|
+
margin: 0;
|
18
|
+
padding: 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
img {
|
22
|
+
border: none;
|
23
|
+
}
|
24
|
+
|
25
|
+
a {
|
26
|
+
color: #333333;
|
27
|
+
text-decoration: underline;
|
28
|
+
outline: none;
|
29
|
+
}
|
30
|
+
|
31
|
+
a:hover {
|
32
|
+
color: #000000;
|
33
|
+
}
|
34
|
+
|
35
|
+
a:active {
|
36
|
+
color: #000000;
|
37
|
+
}
|
38
|
+
|
39
|
+
a:visited {
|
40
|
+
color: #000000;
|
41
|
+
}
|
42
|
+
|
43
|
+
.spacer {
|
44
|
+
width: 100%;
|
45
|
+
height: 150px;
|
46
|
+
}
|
47
|
+
|
48
|
+
.clearer {
|
49
|
+
font-size: 1px;
|
50
|
+
clear: both;
|
51
|
+
}
|
52
|
+
|
53
|
+
/* END OF GENERAL */
|
54
|
+
|
55
|
+
/* LOGIN */
|
56
|
+
|
57
|
+
div.loginBox {
|
58
|
+
width: 300px;
|
59
|
+
height: auto;
|
60
|
+
text-align: center;
|
61
|
+
}
|
62
|
+
|
63
|
+
/* END OF LOGIN */
|
64
|
+
|
65
|
+
/* HEADER */
|
66
|
+
|
67
|
+
#header {
|
68
|
+
background: #EFEFEF;
|
69
|
+
height: 96px;
|
70
|
+
padding: 25px;
|
71
|
+
position: relative;
|
72
|
+
background: url(/kryptonite/images/header.png) repeat-x top left;
|
73
|
+
z-index: 900;
|
74
|
+
}
|
75
|
+
|
76
|
+
#header h1 a img {
|
77
|
+
border: 0;
|
78
|
+
}
|
79
|
+
|
80
|
+
#header h1 a {
|
81
|
+
display: block;
|
82
|
+
width: 230px;
|
83
|
+
height: 33px;
|
84
|
+
text-decoration: none;
|
85
|
+
}
|
86
|
+
|
87
|
+
#dashboard {
|
88
|
+
position: absolute;
|
89
|
+
top: 15px;
|
90
|
+
right: 25px;
|
91
|
+
font-size: 11px;
|
92
|
+
}
|
93
|
+
|
94
|
+
#dashboard ul {
|
95
|
+
list-style: none;
|
96
|
+
}
|
97
|
+
|
98
|
+
#dashboard li {
|
99
|
+
float: left;
|
100
|
+
border-right: 1px solid #ccc;
|
101
|
+
padding: 0 10px 0 0;
|
102
|
+
margin: 0 0 0 10px;
|
103
|
+
color: #777;
|
104
|
+
}
|
105
|
+
|
106
|
+
#dashboard li a {
|
107
|
+
color: #555;
|
108
|
+
font-weight: bold;
|
109
|
+
text-decoration: none;
|
110
|
+
}
|
111
|
+
|
112
|
+
#dashboard li a:hover {
|
113
|
+
color: #000;
|
114
|
+
}
|
115
|
+
|
116
|
+
#navigation {
|
117
|
+
position: absolute;
|
118
|
+
bottom: 28px;
|
119
|
+
left: 25px;
|
120
|
+
font-size: 13px;
|
121
|
+
font-weight: bold;
|
122
|
+
}
|
123
|
+
|
124
|
+
#navigation ul {
|
125
|
+
list-style: none;
|
126
|
+
}
|
127
|
+
|
128
|
+
#navigation li {
|
129
|
+
float: left;
|
130
|
+
margin: 0 2px 0 0;
|
131
|
+
}
|
132
|
+
|
133
|
+
#navigation li a {
|
134
|
+
color: #fff;
|
135
|
+
padding: 11px 12px 9px 12px;
|
136
|
+
background: url(/kryptonite/images/nav.png) repeat-x bottom left;
|
137
|
+
text-decoration: none;
|
138
|
+
}
|
139
|
+
|
140
|
+
#navigation li a:hover {
|
141
|
+
padding: 11px 12px 9px 12px;
|
142
|
+
background: url(/kryptonite/images/nav.png) repeat-x top left;
|
143
|
+
color: #000;
|
144
|
+
}
|
145
|
+
|
146
|
+
#navigation .active a {
|
147
|
+
background: url(/kryptonite/images/nav.png) repeat-x top left;
|
148
|
+
color: #000;
|
149
|
+
}
|
150
|
+
|
151
|
+
#altNavigation {
|
152
|
+
position: absolute;
|
153
|
+
bottom: 19px;
|
154
|
+
right: 25px;
|
155
|
+
font-size: 13px;
|
156
|
+
font-weight: bold;
|
157
|
+
}
|
158
|
+
|
159
|
+
#altNavigation ul {
|
160
|
+
list-style: none;
|
161
|
+
}
|
162
|
+
|
163
|
+
#altNavigation li {
|
164
|
+
float: left;
|
165
|
+
margin: 0 2px 0 0;
|
166
|
+
}
|
167
|
+
|
168
|
+
#altNavigation li a {
|
169
|
+
color: #fff;
|
170
|
+
display: block;
|
171
|
+
padding: 12px 12px 10px 12px;
|
172
|
+
background: url(/kryptonite/images/visitSiteNav.png) repeat-x top left;
|
173
|
+
text-decoration: none;
|
174
|
+
}
|
175
|
+
|
176
|
+
#altNavigation li a:hover {
|
177
|
+
background: url(/kryptonite/images/visitSiteNav.png) repeat-x bottom left;
|
178
|
+
color: #000;
|
179
|
+
}
|
180
|
+
|
181
|
+
/* END OF HEADER */
|
182
|
+
|
183
|
+
/* RIGHT BAR */
|
184
|
+
|
185
|
+
#rightBar {
|
186
|
+
position: absolute;
|
187
|
+
right: 0;
|
188
|
+
top: 0;
|
189
|
+
width: 312px;
|
190
|
+
padding: 0 0 0 6px;
|
191
|
+
height: 100%;
|
192
|
+
background: url(/kryptonite/images/rightNav.png) repeat-y top left;
|
193
|
+
z-index: 10;
|
194
|
+
}
|
195
|
+
|
196
|
+
#rightBar ul {
|
197
|
+
list-style: none;
|
198
|
+
}
|
199
|
+
|
200
|
+
#rightBar li {
|
201
|
+
font-size: 12px;
|
202
|
+
margin: 0 0 12px 0;
|
203
|
+
}
|
204
|
+
|
205
|
+
#rightBar li a {
|
206
|
+
display: block;
|
207
|
+
width: 288px;
|
208
|
+
background: url(/kryptonite/images/rightNavButton.png) no-repeat top left;
|
209
|
+
padding: 11px 0 11px 0;
|
210
|
+
color: #555;
|
211
|
+
text-decoration: none;
|
212
|
+
}
|
213
|
+
|
214
|
+
#rightBar li a:hover {
|
215
|
+
background: url(/kryptonite/images/rightNavButton.png) no-repeat bottom left;
|
216
|
+
color: #000;
|
217
|
+
}
|
218
|
+
|
219
|
+
#rightBar .active a {
|
220
|
+
background: url(/kryptonite/images/rightNavButton.png) no-repeat bottom left;
|
221
|
+
color: #000;
|
222
|
+
}
|
223
|
+
|
224
|
+
/* END OF RIGHT BAR */
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Kryptonite
|
2
|
+
class UpdateGenerator < Rails::Generators::Base
|
3
|
+
|
4
|
+
source_root File.expand_path('../templates', __FILE__)
|
5
|
+
|
6
|
+
def generate_files
|
7
|
+
puts "*** Updating Kryptonite public assets. These should not be modified as they may be overwritten in future updates. ***"
|
8
|
+
|
9
|
+
#stylesheets
|
10
|
+
copy_file "public/kryptonite/stylesheets/screen.css", "public/kryptonite/stylesheets/screen.css"
|
11
|
+
copy_file "public/kryptonite/stylesheets/elements.css", "public/kryptonite/stylesheets/elements.css"
|
12
|
+
copy_file "public/kryptonite/stylesheets/login.css", "public/kryptonite/stylesheets/login.css"
|
13
|
+
|
14
|
+
#javascripts
|
15
|
+
copy_file "public/kryptonite/javascripts/kryptonite.js", "public/kryptonite/javascripts/kryptonite.js"
|
16
|
+
copy_file "public/kryptonite/javascripts/login.js", "public/kryptonite/javascripts/login.js"
|
17
|
+
copy_file "public/kryptonite/javascripts/jquery.js", "public/kryptonite/javascripts/jquery.js"
|
18
|
+
copy_file "public/kryptonite/javascripts/rails.js", "public/kryptonite/javascripts/rails.js"
|
19
|
+
|
20
|
+
#images
|
21
|
+
copy_file "public/kryptonite/images/header.png", "public/kryptonite/images/header.png"
|
22
|
+
copy_file "public/kryptonite/images/nav.png", "public/kryptonite/images/nav.png"
|
23
|
+
copy_file "public/kryptonite/images/rightNav.png", "public/kryptonite/images/rightNav.png"
|
24
|
+
copy_file "public/kryptonite/images/rightNavButton.png", "public/kryptonite/images/rightNavButton.png"
|
25
|
+
copy_file "public/kryptonite/images/kryptonite.png", "public/kryptonite/images/kryptonite.png"
|
26
|
+
copy_file "public/kryptonite/images/visitSiteNav.png", "public/kryptonite/images/visitSiteNav.png"
|
27
|
+
copy_file "public/kryptonite/images/login/top.png", "public/kryptonite/images/login/top.png"
|
28
|
+
copy_file "public/kryptonite/images/login/bottom.png", "public/kryptonite/images/login/bottom.png"
|
29
|
+
|
30
|
+
#icons
|
31
|
+
all_icons = Dir.new(File.expand_path('../templates/public/kryptonite/images/icons/', __FILE__)).entries
|
32
|
+
|
33
|
+
for icon in all_icons
|
34
|
+
if File.extname(icon) == ".png"
|
35
|
+
copy_file "public/kryptonite/images/icons/#{icon}", "public/kryptonite/images/icons/#{icon}"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/kryptonite.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require "kryptonite"
|
2
|
+
require "rails"
|
3
|
+
|
4
|
+
module Kryptonite
|
5
|
+
class Engine < Rails::Engine
|
6
|
+
|
7
|
+
rake_tasks do
|
8
|
+
load "railties/tasks.rake"
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
class RouteConstraint
|
14
|
+
|
15
|
+
def matches?(request)
|
16
|
+
return false if request.fullpath.include?("/kryptonite")
|
17
|
+
return false if request.fullpath.include?("/admin")
|
18
|
+
true
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'authlogic'
|
2
|
+
|
3
|
+
namespace :kryptonite do
|
4
|
+
|
5
|
+
namespace :users do
|
6
|
+
|
7
|
+
desc "Create default admin user"
|
8
|
+
task :create_admin => :environment do
|
9
|
+
|
10
|
+
raise "Usage: specify email address, e.g. rake [task] email=mail@kryptonitecms.com" unless ENV.include?("email")
|
11
|
+
|
12
|
+
admin = Kryptonite::User.new( {:login => 'admin', :name => 'Admin', :email => ENV['email'], :access_level => $KRYPTONITE_USER_ACCESS_LEVEL_ADMIN, :password => 'password', :password_confirmation => 'password'} )
|
13
|
+
|
14
|
+
unless admin.save
|
15
|
+
puts "[Kryptonite] Failed: check that the 'admin' account doesn't already exist."
|
16
|
+
else
|
17
|
+
puts "[Kryptonite] Created new admin user with login 'admin' and password 'password'"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
desc "Remove all users"
|
22
|
+
task :remove_all => :environment do
|
23
|
+
users = Kryptonite::User.find(:all)
|
24
|
+
num_users = users.size
|
25
|
+
users.each { |user| user.destroy }
|
26
|
+
puts "[Kryptonite] Removed #{num_users} user(s)"
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|