loyal_passport 0.0.1
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.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +6 -0
- data/Rakefile +28 -0
- data/app/assets/javascripts/loyal_passport/admin/loyal_passport/assignments.js +2 -0
- data/app/assets/javascripts/loyal_passport/admin/loyal_passport/roles.js +2 -0
- data/app/assets/javascripts/loyal_passport/admin/users.js +2 -0
- data/app/assets/javascripts/loyal_passport/admin.js +0 -0
- data/app/assets/javascripts/loyal_passport/application.js +3 -0
- data/app/assets/javascripts/loyal_passport/login_colorbox.js +2 -0
- data/app/assets/stylesheets/loyal_passport/admin/loyal_passport/assignments.css +4 -0
- data/app/assets/stylesheets/loyal_passport/admin/loyal_passport/roles.css +4 -0
- data/app/assets/stylesheets/loyal_passport/admin/users.css +4 -0
- data/app/assets/stylesheets/loyal_passport/admin.css.scss +0 -0
- data/app/assets/stylesheets/loyal_passport/application.css.scss +278 -0
- data/app/assets/stylesheets/loyal_passport/login_colorbox.css.scss +0 -0
- data/app/assets/stylesheets/scaffold.css +56 -0
- data/app/controllers/loyal_passport/admin/loyal_passport/assignments_controller.rb +11 -0
- data/app/controllers/loyal_passport/admin/loyal_passport/roles_controller.rb +59 -0
- data/app/controllers/loyal_passport/admin/users_controller.rb +29 -0
- data/app/controllers/loyal_passport/application_controller.rb +9 -0
- data/app/controllers/loyal_passport/users/confirmations_controller.rb +6 -0
- data/app/controllers/loyal_passport/users/omniauth_callbacks_controller.rb +17 -0
- data/app/controllers/loyal_passport/users/passwords_controller.rb +8 -0
- data/app/controllers/loyal_passport/users/profile/informations_controller.rb +19 -0
- data/app/controllers/loyal_passport/users/registrations_controller.rb +71 -0
- data/app/controllers/loyal_passport/users/sessions_controller.rb +119 -0
- data/app/controllers/loyal_passport/users/unlocks_controller.rb +7 -0
- data/app/helpers/loyal_passport/admin/loyal_passport/assignments_helper.rb +5 -0
- data/app/helpers/loyal_passport/admin/loyal_passport/roles_helper.rb +5 -0
- data/app/helpers/loyal_passport/admin/users_helper.rb +5 -0
- data/app/helpers/loyal_passport/application_helper.rb +5 -0
- data/app/helpers/loyal_passport/users/confirmations_helper.rb +8 -0
- data/app/helpers/loyal_passport/users/omniauth_callbacks_helper.rb +8 -0
- data/app/helpers/loyal_passport/users/passwords_helper.rb +8 -0
- data/app/helpers/loyal_passport/users/registrations_helper.rb +8 -0
- data/app/helpers/loyal_passport/users/sessions_helper.rb +8 -0
- data/app/helpers/loyal_passport/users/unlocks_helper.rb +8 -0
- data/app/mailers/loyal_passport/users/mailer.rb +6 -0
- data/app/models/ability.rb +47 -0
- data/app/models/concerns/loyal_passport/homeworks_able.rb +36 -0
- data/app/models/loyal_passport/ability.rb +20 -0
- data/app/models/loyal_passport/assignment.rb +10 -0
- data/app/models/loyal_passport/homework.rb +42 -0
- data/app/models/loyal_passport/locker.rb +16 -0
- data/app/models/loyal_passport/oauth_bind.rb +6 -0
- data/app/models/loyal_passport/oauth_info.rb +36 -0
- data/app/models/loyal_passport/oauth_login.rb +9 -0
- data/app/models/loyal_passport/role.rb +25 -0
- data/app/models/session.rb +10 -0
- data/app/models/user.rb +99 -0
- data/app/views/layouts/loyal_passport/application.html.erb +42 -0
- data/app/views/loyal_passport/admin/loyal_passport/assignments/_assignment.html.erb +15 -0
- data/app/views/loyal_passport/admin/loyal_passport/roles/_form.html.erb +5 -0
- data/app/views/loyal_passport/admin/loyal_passport/roles/edit.html.erb +18 -0
- data/app/views/loyal_passport/admin/loyal_passport/roles/index.html.erb +25 -0
- data/app/views/loyal_passport/admin/loyal_passport/roles/new.html.erb +15 -0
- data/app/views/loyal_passport/admin/loyal_passport/roles/show.html.erb +59 -0
- data/app/views/loyal_passport/admin/users/_form.html.erb +27 -0
- data/app/views/loyal_passport/admin/users/edit.html.erb +14 -0
- data/app/views/loyal_passport/admin/users/index.html.erb +25 -0
- data/app/views/loyal_passport/admin/users/show.html.erb +27 -0
- data/app/views/loyal_passport/error/access_deny.html.erb +3 -0
- data/app/views/loyal_passport/users/confirmations/new.html.erb +19 -0
- data/app/views/loyal_passport/users/mailer/confirmation_instructions.html.erb +5 -0
- data/app/views/loyal_passport/users/mailer/reset_password_instructions.html.erb +8 -0
- data/app/views/loyal_passport/users/mailer/unlock_instructions.html.erb +7 -0
- data/app/views/loyal_passport/users/passwords/edit.html.erb +23 -0
- data/app/views/loyal_passport/users/passwords/new.html.erb +19 -0
- data/app/views/loyal_passport/users/profile/informations/index.html.erb +35 -0
- data/app/views/loyal_passport/users/registrations/edit.html.erb +47 -0
- data/app/views/loyal_passport/users/registrations/new.html.erb +40 -0
- data/app/views/loyal_passport/users/sessions/new.html.erb +26 -0
- data/app/views/loyal_passport/users/shared/_flashes.html.erb +8 -0
- data/app/views/loyal_passport/users/shared/_footer.html.erb +6 -0
- data/app/views/loyal_passport/users/shared/_links.erb +41 -0
- data/app/views/loyal_passport/users/shared/_nav.html.erb +1 -0
- data/app/views/loyal_passport/users/shared/_status.html.erb +18 -0
- data/app/views/loyal_passport/users/unlocks/new.html.erb +20 -0
- data/config/initializers/loyal_passport.rb +265 -0
- data/config/locales/loyal_passport/en/devise.en.yml +63 -0
- data/config/locales/loyal_passport/en/loyal_passport.en.yml +20 -0
- data/config/locales/loyal_passport/en/views/mailer.en.yml +15 -0
- data/config/locales/loyal_passport/zh-CN/devise.zh-CN.yml +65 -0
- data/config/locales/loyal_passport/zh-CN/loyal_passport.zh-CN.yml +47 -0
- data/config/locales/loyal_passport/zh-CN/models/loyal_passport/assignment.zh-CN.yml +24 -0
- data/config/locales/loyal_passport/zh-CN/user.yml +82 -0
- data/config/locales/loyal_passport/zh-CN/views/mailer.zh-CN.yml +14 -0
- data/config/routes.rb +36 -0
- data/db/migrate/20121123023890_create_users.rb +80 -0
- data/db/migrate/20121123025990_create_loyal_passport_roles.rb +24 -0
- data/db/migrate/20121123026990_create_loyal_passport_assignments.rb +24 -0
- data/db/migrate/20121125104021_add_sessions_table.rb +13 -0
- data/db/migrate/20130323050903_create_loyal_passport_lockers.rb +19 -0
- data/db/migrate/20130526062222_create_loyal_passport_homeworks.rb +12 -0
- data/db/migrate/20130625053301_create_loyal_passport_oauth_infos.rb +40 -0
- data/db/migrate/20130625053334_create_loyal_passport_oauth_binds.rb +17 -0
- data/db/migrate/20130625053410_create_loyal_passport_oauth_logins.rb +15 -0
- data/db/migrate/20130625055117_add_gender_to_users.rb +7 -0
- data/lib/loyal_passport/acts/acts_as_author_able.rb +26 -0
- data/lib/loyal_passport/acts/acts_as_locker_able.rb +26 -0
- data/lib/loyal_passport/acts.rb +12 -0
- data/lib/loyal_passport/config.rb +158 -0
- data/lib/loyal_passport/controllers/controller_extends.rb +28 -0
- data/lib/loyal_passport/controllers/custom_failure_app.rb +238 -0
- data/lib/loyal_passport/controllers/devise_extends.rb +26 -0
- data/lib/loyal_passport/controllers/passport_basic.rb +65 -0
- data/lib/loyal_passport/controllers/users_basic.rb +33 -0
- data/lib/loyal_passport/devise_helper.rb +22 -0
- data/lib/loyal_passport/engine.rb +11 -0
- data/lib/loyal_passport/user_parameter_sanitizer.rb +25 -0
- data/lib/loyal_passport/utils/array_util.rb +16 -0
- data/lib/loyal_passport/utils/data_util.rb +181 -0
- data/lib/loyal_passport/utils.rb +5 -0
- data/lib/loyal_passport/version.rb +4 -0
- data/lib/loyal_passport.rb +30 -0
- data/lib/tasks/loyal_passport_tasks.rake +4 -0
- metadata +209 -0
data/MIT-LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright 2012 YOURNAME
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env rake
|
|
2
|
+
begin
|
|
3
|
+
require 'bundler/setup'
|
|
4
|
+
rescue LoadError
|
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
|
6
|
+
end
|
|
7
|
+
begin
|
|
8
|
+
require 'rdoc/task'
|
|
9
|
+
rescue LoadError
|
|
10
|
+
require 'rdoc/rdoc'
|
|
11
|
+
require 'rake/rdoctask'
|
|
12
|
+
RDoc::Task = Rake::RDocTask
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
|
16
|
+
rdoc.rdoc_dir = 'rdoc'
|
|
17
|
+
rdoc.title = 'LoyalPassport'
|
|
18
|
+
rdoc.options << '--line-numbers'
|
|
19
|
+
rdoc.rdoc_files.include('README.rdoc')
|
|
20
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
|
24
|
+
load 'rails/tasks/engine.rake'
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
Bundler::GemHelper.install_tasks
|
|
28
|
+
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
/*
|
|
2
|
+
*= require_self
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
$page-default-width: 1024px;
|
|
6
|
+
$page-nav-background-color: #DB70AA;
|
|
7
|
+
$page-sub-nav-background-color: #EFEFEF;
|
|
8
|
+
$page-body-background-color: #ECE5D8;
|
|
9
|
+
|
|
10
|
+
body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, form, fieldset, input, textarea, p, blockquote, th, td {
|
|
11
|
+
margin: 0;
|
|
12
|
+
padding: 0;
|
|
13
|
+
}
|
|
14
|
+
table {
|
|
15
|
+
border-collapse: collapse;
|
|
16
|
+
border-spacing: 0;
|
|
17
|
+
}
|
|
18
|
+
fieldset, img {
|
|
19
|
+
border: 0 none;
|
|
20
|
+
}
|
|
21
|
+
address, caption, cite, code, dfn, em, strong, th, var {
|
|
22
|
+
font-style: normal;
|
|
23
|
+
font-weight: normal;
|
|
24
|
+
}
|
|
25
|
+
ol, ul {
|
|
26
|
+
list-style: none outside none;
|
|
27
|
+
}
|
|
28
|
+
caption, th {
|
|
29
|
+
text-align: left;
|
|
30
|
+
}
|
|
31
|
+
h1, h2, h3, h4, h5, h6 {
|
|
32
|
+
font-size: 100%;
|
|
33
|
+
font-weight: normal;
|
|
34
|
+
}
|
|
35
|
+
abbr, acronym {
|
|
36
|
+
border: 0 none;
|
|
37
|
+
}
|
|
38
|
+
textarea, input {
|
|
39
|
+
resize: none;
|
|
40
|
+
}
|
|
41
|
+
button {
|
|
42
|
+
border: 0 none;
|
|
43
|
+
margin: 0;
|
|
44
|
+
outline: medium none;
|
|
45
|
+
overflow: visible;
|
|
46
|
+
padding: 0;
|
|
47
|
+
width: auto;
|
|
48
|
+
}
|
|
49
|
+
body {
|
|
50
|
+
background-color: $page-body-background-color;
|
|
51
|
+
color: #503E2C;
|
|
52
|
+
font-family: Arial,Tahoma,'hiragino sans gb',Helvetica;
|
|
53
|
+
font-size: 14px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
a {
|
|
57
|
+
color: #9B8878;
|
|
58
|
+
text-decoration: none;
|
|
59
|
+
}
|
|
60
|
+
a:hover {
|
|
61
|
+
color: red !important;
|
|
62
|
+
}
|
|
63
|
+
.clearfix:after {
|
|
64
|
+
clear: both;
|
|
65
|
+
content: ".";
|
|
66
|
+
display: block;
|
|
67
|
+
height: 0;
|
|
68
|
+
visibility: hidden;
|
|
69
|
+
}
|
|
70
|
+
.clearfix {
|
|
71
|
+
display: inline-block;
|
|
72
|
+
}
|
|
73
|
+
.clearfix {
|
|
74
|
+
display: block;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
textarea, input[type="text"], input[type="email"], input[type="password"] {
|
|
78
|
+
border: 1px solid #DACEB7;
|
|
79
|
+
border-radius: 4px 4px 4px 4px;
|
|
80
|
+
box-shadow: 0 2px 1px rgba(0, 0, 0, 0.05) inset, 0 1px 0 #FFFFFF;
|
|
81
|
+
line-height: 100%;
|
|
82
|
+
}
|
|
83
|
+
textarea:focus, input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus {
|
|
84
|
+
border: 1px solid #996633;
|
|
85
|
+
box-shadow: 0 0 4px rgba(153, 102, 51, 0.6);
|
|
86
|
+
outline: medium none;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.text-right {
|
|
90
|
+
text-align: right;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.wrapper {
|
|
94
|
+
margin: 0 auto;
|
|
95
|
+
width: $page-default-width;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
#nav {
|
|
99
|
+
background: $page-nav-background-color;
|
|
100
|
+
|
|
101
|
+
.nav-inner {
|
|
102
|
+
margin: 0 auto;
|
|
103
|
+
padding: 0;
|
|
104
|
+
|
|
105
|
+
color: #FFFFFF;
|
|
106
|
+
|
|
107
|
+
a {
|
|
108
|
+
color: #FFFFFF;
|
|
109
|
+
line-height: 40px;
|
|
110
|
+
margin: auto 6px;
|
|
111
|
+
text-align: center;
|
|
112
|
+
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
ul.nav-links {
|
|
116
|
+
list-style: none outside none;
|
|
117
|
+
margin: 0;
|
|
118
|
+
padding: 0;
|
|
119
|
+
|
|
120
|
+
li {
|
|
121
|
+
float: left;
|
|
122
|
+
list-style: none outside none;
|
|
123
|
+
margin: 0;
|
|
124
|
+
padding: 0;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
.status {
|
|
128
|
+
float: right;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
#footer {
|
|
134
|
+
.footer-inner {
|
|
135
|
+
text-align: center;
|
|
136
|
+
|
|
137
|
+
a {
|
|
138
|
+
color: #888;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
#container {
|
|
144
|
+
padding: 10px 0;
|
|
145
|
+
|
|
146
|
+
.content-block {
|
|
147
|
+
|
|
148
|
+
.sub-nav {
|
|
149
|
+
background-color: $page-sub-nav-background-color;
|
|
150
|
+
border: 1px solid #FBEED5;
|
|
151
|
+
border-radius: 4px 4px 4px 4px;
|
|
152
|
+
margin-bottom: 18px;
|
|
153
|
+
padding: 8px 35px 8px 14px;
|
|
154
|
+
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.main-content {
|
|
158
|
+
|
|
159
|
+
form {
|
|
160
|
+
padding: 10px;
|
|
161
|
+
background: #efefef;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
margin: 0 auto;
|
|
165
|
+
padding: 10px;
|
|
166
|
+
width: 660px;
|
|
167
|
+
float: left;
|
|
168
|
+
|
|
169
|
+
.other-links {
|
|
170
|
+
padding: 5px;
|
|
171
|
+
|
|
172
|
+
.link-line {
|
|
173
|
+
padding: 5px;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.error-explanation {
|
|
178
|
+
border: 2px solid #FF6347;
|
|
179
|
+
padding: 7px;
|
|
180
|
+
padding-bottom: 0;
|
|
181
|
+
background-color: #f0f0f0;
|
|
182
|
+
margin: 10px;
|
|
183
|
+
|
|
184
|
+
h2 {
|
|
185
|
+
text-align: left;
|
|
186
|
+
font-weight: bold;
|
|
187
|
+
padding: 5px 5px 5px 15px;
|
|
188
|
+
font-size: 12px;
|
|
189
|
+
margin: -7px;
|
|
190
|
+
margin-bottom: 0px;
|
|
191
|
+
background-color: #FF6347;
|
|
192
|
+
color: #fff;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
ul {
|
|
196
|
+
margin-left: 15px;
|
|
197
|
+
li {
|
|
198
|
+
padding: 5px 0 0 0;
|
|
199
|
+
font-size: 12px;
|
|
200
|
+
list-style: square;
|
|
201
|
+
}
|
|
202
|
+
padding-bottom: 5px;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.side-content {
|
|
209
|
+
float: right;
|
|
210
|
+
width: 320px;
|
|
211
|
+
padding: 10px;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
form {
|
|
216
|
+
fieldset {
|
|
217
|
+
|
|
218
|
+
legend {
|
|
219
|
+
border-color: #EEEEEE;
|
|
220
|
+
border-style: none none solid;
|
|
221
|
+
border-width: 0 0 1px;
|
|
222
|
+
color: #333333;
|
|
223
|
+
display: block;
|
|
224
|
+
font-size: 22px;
|
|
225
|
+
line-height: 36px;
|
|
226
|
+
margin-bottom: 15px;
|
|
227
|
+
padding: 0;
|
|
228
|
+
width: 100%;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.fields {
|
|
232
|
+
padding: 5px;
|
|
233
|
+
.field {
|
|
234
|
+
margin: 5px;
|
|
235
|
+
line-height: 1.5;
|
|
236
|
+
|
|
237
|
+
input {
|
|
238
|
+
font-size: 26px;
|
|
239
|
+
padding: 5px;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
input[type="text"], input[type='email'], input[type='password'] {
|
|
243
|
+
width: 380px;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.error_message {
|
|
247
|
+
padding: 5px;
|
|
248
|
+
color: red;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
input[type="submit"] {
|
|
252
|
+
cursor: pointer;
|
|
253
|
+
font-size: 16px;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.flash-messages {
|
|
261
|
+
.notice, .alert {
|
|
262
|
+
background-color: #FCF8E3;
|
|
263
|
+
border: 1px solid #FBEED5;
|
|
264
|
+
border-radius: 4px 4px 4px 4px;
|
|
265
|
+
margin-bottom: 18px;
|
|
266
|
+
padding: 8px 35px 8px 14px;
|
|
267
|
+
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.notice {
|
|
271
|
+
color: green;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.alert {
|
|
275
|
+
color: red;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
body { background-color: #fff; color: #333; }
|
|
2
|
+
|
|
3
|
+
body, p, ol, ul, td {
|
|
4
|
+
font-family: verdana, arial, helvetica, sans-serif;
|
|
5
|
+
font-size: 13px;
|
|
6
|
+
line-height: 18px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
pre {
|
|
10
|
+
background-color: #eee;
|
|
11
|
+
padding: 10px;
|
|
12
|
+
font-size: 11px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
a { color: #000; }
|
|
16
|
+
a:visited { color: #666; }
|
|
17
|
+
a:hover { color: #fff; background-color:#000; }
|
|
18
|
+
|
|
19
|
+
div.field, div.actions {
|
|
20
|
+
margin-bottom: 10px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
#notice {
|
|
24
|
+
color: green;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.field_with_errors {
|
|
28
|
+
padding: 2px;
|
|
29
|
+
background-color: red;
|
|
30
|
+
display: table;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
#error_explanation {
|
|
34
|
+
width: 450px;
|
|
35
|
+
border: 2px solid red;
|
|
36
|
+
padding: 7px;
|
|
37
|
+
padding-bottom: 0;
|
|
38
|
+
margin-bottom: 20px;
|
|
39
|
+
background-color: #f0f0f0;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
#error_explanation h2 {
|
|
43
|
+
text-align: left;
|
|
44
|
+
font-weight: bold;
|
|
45
|
+
padding: 5px 5px 5px 15px;
|
|
46
|
+
font-size: 12px;
|
|
47
|
+
margin: -7px;
|
|
48
|
+
margin-bottom: 0px;
|
|
49
|
+
background-color: #c00;
|
|
50
|
+
color: #fff;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
#error_explanation ul li {
|
|
54
|
+
font-size: 12px;
|
|
55
|
+
list-style: square;
|
|
56
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
|
2
|
+
module LoyalPassport
|
|
3
|
+
class Admin::LoyalPassport::AssignmentsController < ApplicationController
|
|
4
|
+
def destroy
|
|
5
|
+
@loyal_passport_assignment = ::LoyalPassport::Assignment.find params[:id]
|
|
6
|
+
@loyal_passport_assignment.destroy
|
|
7
|
+
|
|
8
|
+
redirect_to params[:return_to]
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
|
2
|
+
module LoyalPassport
|
|
3
|
+
class Admin::LoyalPassport::RolesController < ::LoyalAdmin::ApplicationController
|
|
4
|
+
def index
|
|
5
|
+
@loyal_passport_roles = ::LoyalPassport::Role.page(params[:page]).per(30)
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def show
|
|
9
|
+
@loyal_passport_role = ::LoyalPassport::Role.find params[:id]
|
|
10
|
+
|
|
11
|
+
@loyal_passport_assignments = @loyal_passport_role.assignments.includes(:user)
|
|
12
|
+
|
|
13
|
+
@users = ::User.page(params[:page]).per(50)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def new
|
|
17
|
+
@loyal_passport_role = ::LoyalPassport::Role.new
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def create
|
|
21
|
+
params[:loyal_passport_role] ||= {}
|
|
22
|
+
params[:loyal_passport_role][:user_ids] ||= []
|
|
23
|
+
|
|
24
|
+
@loyal_passport_role = ::LoyalPassport::Role.new(params[:loyal_passport_role])
|
|
25
|
+
|
|
26
|
+
if @loyal_passport_role.save
|
|
27
|
+
redirect_to loyal_passport_app.admin_loyal_passport_role_url(:id => @loyal_passport_role.id)
|
|
28
|
+
else
|
|
29
|
+
render :new
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def edit
|
|
34
|
+
@loyal_passport_role = ::LoyalPassport::Role.find params[:id]
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def update
|
|
38
|
+
params[:loyal_passport_role] ||= {}
|
|
39
|
+
params[:loyal_passport_role][:user_ids] ||= []
|
|
40
|
+
|
|
41
|
+
@loyal_passport_role = ::LoyalPassport::Role.find params[:id]
|
|
42
|
+
|
|
43
|
+
if @loyal_passport_role.update_attributes(params[:loyal_passport_role])
|
|
44
|
+
redirect_to params[:return_to] || loyal_passport_app.admin_loyal_passport_role_url(:id => @loyal_passport_role.id)
|
|
45
|
+
else
|
|
46
|
+
render :edit
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def destroy
|
|
51
|
+
@loyal_passport_role = ::LoyalPassport::Role.find params[:id]
|
|
52
|
+
|
|
53
|
+
@loyal_passport_role.destroy
|
|
54
|
+
|
|
55
|
+
redirect_to loyal_passport_app.admin_loyal_passport_roles_url
|
|
56
|
+
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
|
2
|
+
module LoyalPassport
|
|
3
|
+
class Admin::UsersController < ::LoyalAdmin::ApplicationController
|
|
4
|
+
def index
|
|
5
|
+
@users = ::User.page(params[:page]).per(30)
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def show
|
|
9
|
+
@user = ::User.find params[:id]
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def edit
|
|
13
|
+
@user = ::User.find params[:id]
|
|
14
|
+
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def update
|
|
18
|
+
params[:user][:role_ids] ||= []
|
|
19
|
+
@user = ::User.find params[:id]
|
|
20
|
+
|
|
21
|
+
if @user.update_attributes(params[:user])
|
|
22
|
+
redirect_to loyal_passport_app.admin_user_url(@user)
|
|
23
|
+
else
|
|
24
|
+
render :edit
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
|
2
|
+
module LoyalPassport
|
|
3
|
+
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
|
4
|
+
include ::LoyalPassport::Controllers::UsersBasic
|
|
5
|
+
|
|
6
|
+
# def github
|
|
7
|
+
# raise request.env['omniauth.auth'].to_yaml
|
|
8
|
+
# end
|
|
9
|
+
|
|
10
|
+
[:github, :qq_connect].each do |provider|
|
|
11
|
+
define_method :"#{provider}" do
|
|
12
|
+
raise request.env['omniauth.auth'].to_yaml
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
|
2
|
+
module LoyalPassport::Users::Profile
|
|
3
|
+
class InformationsController < ::DeviseController
|
|
4
|
+
include ::LoyalPassport::Controllers::UsersBasic
|
|
5
|
+
|
|
6
|
+
before_filter do |controller|
|
|
7
|
+
controller.send :authenticate_user!, :force => true
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# before_filter :loyal_authenticate_admin!
|
|
11
|
+
|
|
12
|
+
# users/profile/informations
|
|
13
|
+
def index
|
|
14
|
+
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
|
2
|
+
module LoyalPassport
|
|
3
|
+
class Users::RegistrationsController < ::Devise::RegistrationsController
|
|
4
|
+
include ::LoyalPassport::Controllers::UsersBasic
|
|
5
|
+
|
|
6
|
+
def create
|
|
7
|
+
sign_up_params.permit(:nick_name, :permalink, :true_name, :captcha, :captcha_key)
|
|
8
|
+
|
|
9
|
+
build_resource(sign_up_params)
|
|
10
|
+
|
|
11
|
+
if resource.save_with_captcha
|
|
12
|
+
if resource.active_for_authentication?
|
|
13
|
+
set_flash_message :notice, :signed_up if is_navigational_format?
|
|
14
|
+
sign_up(resource_name, resource)
|
|
15
|
+
respond_with resource, :location => after_sign_up_path_for(resource)
|
|
16
|
+
else
|
|
17
|
+
set_flash_message :notice, :"signed_up_but_#{resource.inactive_message}" if is_navigational_format?
|
|
18
|
+
expire_session_data_after_sign_in!
|
|
19
|
+
respond_with resource, :location => after_inactive_sign_up_path_for(resource)
|
|
20
|
+
end
|
|
21
|
+
else
|
|
22
|
+
clean_up_passwords resource
|
|
23
|
+
respond_with resource
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# def create
|
|
28
|
+
# build_resource
|
|
29
|
+
|
|
30
|
+
# if resource.save_with_captcha
|
|
31
|
+
# if resource.active_for_authentication?
|
|
32
|
+
# set_flash_message :notice, :signed_up if is_navigational_format?
|
|
33
|
+
# sign_in(resource_name, resource)
|
|
34
|
+
# respond_with resource, :location => after_sign_up_path_for(resource)
|
|
35
|
+
# else
|
|
36
|
+
# set_flash_message :notice, :"signed_up_but_#{resource.inactive_message}" if is_navigational_format?
|
|
37
|
+
# expire_session_data_after_sign_in!
|
|
38
|
+
# respond_with resource, :location => after_inactive_sign_up_path_for(resource)
|
|
39
|
+
# end
|
|
40
|
+
# else
|
|
41
|
+
# clean_up_passwords resource
|
|
42
|
+
# respond_with resource
|
|
43
|
+
# end
|
|
44
|
+
# end
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
# # GET /resource/cancel
|
|
48
|
+
# # Forces the session data which is usually expired after sign
|
|
49
|
+
# # in to be expired now. This is useful if the user wants to
|
|
50
|
+
# # cancel oauth signing in/up in the middle of the process,
|
|
51
|
+
# # removing all OAuth session data.
|
|
52
|
+
# def cancel
|
|
53
|
+
# expire_session_data_after_sign_in!
|
|
54
|
+
# redirect_to new_registration_path(resource_name)
|
|
55
|
+
# end
|
|
56
|
+
|
|
57
|
+
# def destroy
|
|
58
|
+
# if resource.can_cancel_account?
|
|
59
|
+
# resource.destroy
|
|
60
|
+
# Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name)
|
|
61
|
+
# set_flash_message :notice, :destroyed if is_navigational_format?
|
|
62
|
+
# respond_with_navigational(resource){ redirect_to after_sign_out_path_for(resource_name) }
|
|
63
|
+
# else
|
|
64
|
+
# flash[:alert] = I18n.t('loyal_passport.logics.you_cannot_cancel_account')
|
|
65
|
+
# redirect_to params[:return_to]
|
|
66
|
+
# end
|
|
67
|
+
# end
|
|
68
|
+
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|