tiny_passport 0.0.2 → 0.0.3
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.
- checksums.yaml +4 -4
- data/app/ables/tiny_passport/account_validate_able.rb +1 -0
- data/app/ables/tiny_passport/aggrement_term_able.rb +1 -0
- data/app/assets/images/tiny_passport/loading-mini.gif +0 -0
- data/app/assets/images/tiny_passport/oauth-icons.gif +0 -0
- data/app/assets/images/tiny_passport/oauth-icons.png +0 -0
- data/app/assets/stylesheets/tiny_passport/application.css.scss +20 -0
- data/app/displays/tiny_passport/account_display.rb +4 -6
- data/app/displays/tiny_passport/login_email_display.rb +19 -0
- data/app/displays/tiny_passport/oauth_login_display.rb +2 -0
- data/app/displays/tiny_passport/oauth_token_display.rb +2 -0
- data/app/forms/tiny_passport/account_active_form.rb +14 -7
- data/app/forms/tiny_passport/confirmation_token_form.rb +17 -8
- data/app/forms/tiny_passport/oauth/bind_connect_form.rb +4 -8
- data/app/forms/tiny_passport/oauth/bind_disconnect_form.rb +11 -3
- data/app/forms/tiny_passport/oauth/callback_form.rb +11 -8
- data/app/forms/tiny_passport/oauth/login_connect_form.rb +5 -12
- data/app/forms/tiny_passport/oauth/login_disconnect_form.rb +50 -0
- data/app/forms/tiny_passport/registration_form.rb +46 -35
- data/app/forms/tiny_passport/remember_token_auth_form.rb +2 -2
- data/app/forms/tiny_passport/reset_password_form.rb +4 -4
- data/app/forms/tiny_passport/session_form.rb +12 -11
- data/app/forms/tiny_passport/update_login_email_form.rb +68 -0
- data/app/forms/tiny_passport/update_password_form.rb +1 -1
- data/app/mailers/tiny_passport/registration_mailer.rb +1 -1
- data/app/models/concerns/tiny_passport/basic_status_able.rb +28 -0
- data/app/models/tiny_passport/account.rb +0 -1
- data/app/models/tiny_passport/login_email.rb +26 -16
- data/app/models/tiny_passport/oauth_login.rb +1 -12
- data/app/models/tiny_passport/oauth_token.rb +8 -2
- data/app/queries/tiny_passport/account_query.rb +4 -1
- data/config/locales/en/forms.en.yml +13 -0
- data/config/locales/zh-CN/forms.zh-CN.yml +44 -5
- data/db/migrate/20131105104415_create_tiny_passport_login_records.rb +1 -0
- data/lib/omniauth/strategies/github.rb +58 -0
- data/lib/omniauth/strategies/qq_connect.rb +1 -1
- data/lib/omniauth/strategies/weibo.rb +93 -0
- data/lib/tiny_passport/engine.rb +3 -3
- data/lib/tiny_passport/http_authcenter.rb +7 -2
- data/lib/tiny_passport/omniauth/strategable.rb +1 -0
- data/lib/tiny_passport/version.rb +1 -1
- data/test/dummy/db/schema.rb +2 -1
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/test.log +8973 -0
- data/test/forms/tiny_passport/oauth/callback_form_test.rb +2 -2
- data/test/forms/tiny_passport/session_form_test.rb +0 -2
- metadata +13 -12
- data/app/assets/stylesheets/tiny_passport/application.css +0 -13
- data/app/forms/tiny_passport/welcome_email_form.rb +0 -47
- data/app/services/tiny_passport/account_service.rb +0 -43
- data/app/services/tiny_passport/email_send_service.rb +0 -32
- data/app/services/tiny_passport/oauth_service.rb +0 -11
- data/test/dummy/tmp/cache/271/2A1/tiny_cache%2Fmodels%2FTinyPassport%3A%3AAccount%2F1%2F1 +0 -0
- data/test/dummy/tmp/cache/EDF/4C1/tiny_cache%2Fmodel_uniq_keys%2FTinyPassport%3A%3ALoginEmail%2F%5B%5B%22account_id%22%2C+1%5D%5D +0 -1
@@ -48,7 +48,6 @@ module TinyPassport
|
|
48
48
|
:remembered => true
|
49
49
|
))
|
50
50
|
assert @session_form.success?
|
51
|
-
|
52
51
|
login_record = @session_form.result[:login_record]
|
53
52
|
assert login_record.remembered
|
54
53
|
end
|
@@ -62,7 +61,6 @@ module TinyPassport
|
|
62
61
|
:remembered => false
|
63
62
|
))
|
64
63
|
assert @session_form.success?
|
65
|
-
|
66
64
|
login_record = @session_form.result[:login_record]
|
67
65
|
assert_equal login_record.remembered, false
|
68
66
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tiny_passport
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- happy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -136,10 +136,14 @@ files:
|
|
136
136
|
- app/ables/tiny_passport/aggrement_term_able.rb
|
137
137
|
- app/ables/tiny_passport/formable.rb
|
138
138
|
- app/ables/tiny_passport/query_able.rb
|
139
|
+
- app/assets/images/tiny_passport/loading-mini.gif
|
140
|
+
- app/assets/images/tiny_passport/oauth-icons.gif
|
141
|
+
- app/assets/images/tiny_passport/oauth-icons.png
|
139
142
|
- app/assets/javascripts/tiny_passport/application.js
|
140
|
-
- app/assets/stylesheets/tiny_passport/application.css
|
143
|
+
- app/assets/stylesheets/tiny_passport/application.css.scss
|
141
144
|
- app/controllers/tiny_passport/application_controller.rb
|
142
145
|
- app/displays/tiny_passport/account_display.rb
|
146
|
+
- app/displays/tiny_passport/login_email_display.rb
|
143
147
|
- app/displays/tiny_passport/oauth_login_display.rb
|
144
148
|
- app/displays/tiny_passport/oauth_token_display.rb
|
145
149
|
- app/errors/tiny_passport/alert_authorized_error.rb
|
@@ -151,17 +155,19 @@ files:
|
|
151
155
|
- app/forms/tiny_passport/oauth/bind_disconnect_form.rb
|
152
156
|
- app/forms/tiny_passport/oauth/callback_form.rb
|
153
157
|
- app/forms/tiny_passport/oauth/login_connect_form.rb
|
158
|
+
- app/forms/tiny_passport/oauth/login_disconnect_form.rb
|
154
159
|
- app/forms/tiny_passport/registration_form.rb
|
155
160
|
- app/forms/tiny_passport/remember_token_auth_form.rb
|
156
161
|
- app/forms/tiny_passport/reset_password_form.rb
|
157
162
|
- app/forms/tiny_passport/reset_password_token_form.rb
|
158
163
|
- app/forms/tiny_passport/session_form.rb
|
164
|
+
- app/forms/tiny_passport/update_login_email_form.rb
|
159
165
|
- app/forms/tiny_passport/update_password_form.rb
|
160
|
-
- app/forms/tiny_passport/welcome_email_form.rb
|
161
166
|
- app/helpers/tiny_passport/application_helper.rb
|
162
167
|
- app/mailers/tiny_passport/registration_mailer.rb
|
163
168
|
- app/mailers/tiny_passport/reset_password_mailer.rb
|
164
169
|
- app/models/concerns/tiny_passport/account_authenticatable.rb
|
170
|
+
- app/models/concerns/tiny_passport/basic_status_able.rb
|
165
171
|
- app/models/tiny_passport/account.rb
|
166
172
|
- app/models/tiny_passport/avatar.rb
|
167
173
|
- app/models/tiny_passport/login_email.rb
|
@@ -171,9 +177,6 @@ files:
|
|
171
177
|
- app/models/tiny_passport/oauth_login.rb
|
172
178
|
- app/models/tiny_passport/oauth_token.rb
|
173
179
|
- app/queries/tiny_passport/account_query.rb
|
174
|
-
- app/services/tiny_passport/account_service.rb
|
175
|
-
- app/services/tiny_passport/email_send_service.rb
|
176
|
-
- app/services/tiny_passport/oauth_service.rb
|
177
180
|
- app/views/layouts/tiny_passport/application.html.erb
|
178
181
|
- app/views/layouts/tiny_passport/mailer.html.erb
|
179
182
|
- app/views/tiny_passport/registration_mailer/send_confirmation_token.html.erb
|
@@ -190,7 +193,9 @@ files:
|
|
190
193
|
- db/migrate/20131105104738_create_tiny_passport_oauth_infos.rb
|
191
194
|
- db/migrate/20131105104847_create_tiny_passport_avatars.rb
|
192
195
|
- db/migrate/20131107031935_create_tiny_passport_login_emails.rb
|
196
|
+
- lib/omniauth/strategies/github.rb
|
193
197
|
- lib/omniauth/strategies/qq_connect.rb
|
198
|
+
- lib/omniauth/strategies/weibo.rb
|
194
199
|
- lib/tasks/tiny_passport_tasks.rake
|
195
200
|
- lib/tiny_passport.rb
|
196
201
|
- lib/tiny_passport/config.rb
|
@@ -234,8 +239,6 @@ files:
|
|
234
239
|
- test/dummy/public/422.html
|
235
240
|
- test/dummy/public/500.html
|
236
241
|
- test/dummy/public/favicon.ico
|
237
|
-
- test/dummy/tmp/cache/271/2A1/tiny_cache%2Fmodels%2FTinyPassport%3A%3AAccount%2F1%2F1
|
238
|
-
- test/dummy/tmp/cache/EDF/4C1/tiny_cache%2Fmodel_uniq_keys%2FTinyPassport%3A%3ALoginEmail%2F%5B%5B%22account_id%22%2C+1%5D%5D
|
239
242
|
- test/fixtures/tiny_passport/avatars.yml
|
240
243
|
- test/fixtures/tiny_passport/login_emails.yml
|
241
244
|
- test/fixtures/tiny_passport/login_records.yml
|
@@ -282,7 +285,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
282
285
|
version: '0'
|
283
286
|
requirements: []
|
284
287
|
rubyforge_project:
|
285
|
-
rubygems_version: 2.2.
|
288
|
+
rubygems_version: 2.2.2
|
286
289
|
signing_key:
|
287
290
|
specification_version: 4
|
288
291
|
summary: Summary of TinyPassport.
|
@@ -321,8 +324,6 @@ test_files:
|
|
321
324
|
- test/dummy/public/favicon.ico
|
322
325
|
- test/dummy/Rakefile
|
323
326
|
- test/dummy/README.rdoc
|
324
|
-
- test/dummy/tmp/cache/271/2A1/tiny_cache%2Fmodels%2FTinyPassport%3A%3AAccount%2F1%2F1
|
325
|
-
- test/dummy/tmp/cache/EDF/4C1/tiny_cache%2Fmodel_uniq_keys%2FTinyPassport%3A%3ALoginEmail%2F%5B%5B%22account_id%22%2C+1%5D%5D
|
326
327
|
- test/fixtures/tiny_passport/avatars.yml
|
327
328
|
- test/fixtures/tiny_passport/login_emails.yml
|
328
329
|
- test/fixtures/tiny_passport/login_records.yml
|
@@ -1,13 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
-
* listed below.
|
4
|
-
*
|
5
|
-
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
-
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
-
*
|
8
|
-
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
9
|
-
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
-
*
|
11
|
-
*= require_self
|
12
|
-
*= require_tree .
|
13
|
-
*/
|
@@ -1,47 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
module TinyPassport
|
3
|
-
# 欢迎邮件的发送
|
4
|
-
class WelcomeEmailForm
|
5
|
-
include ::TinyPassport::Formable
|
6
|
-
|
7
|
-
attr_accessor :login_email_value # 注册邮箱
|
8
|
-
|
9
|
-
# 校验
|
10
|
-
self.email_validates_of :login_email_value, :if => :login_email_required?
|
11
|
-
|
12
|
-
validate :verify_login_email_present
|
13
|
-
|
14
|
-
def login_email_required?
|
15
|
-
true
|
16
|
-
end
|
17
|
-
|
18
|
-
# 登录邮箱
|
19
|
-
def login_email
|
20
|
-
@login_email ||= ::TinyPassport::LoginEmail.where(:value => self.login_email_value).first
|
21
|
-
end
|
22
|
-
|
23
|
-
def submit params={}
|
24
|
-
self.login_email_value = params[:login_email_value]
|
25
|
-
|
26
|
-
if self.valid? && self.success?
|
27
|
-
self.login_email.generate_encrypted_confirmation_token
|
28
|
-
self.login_email.confirmation_send_at = ::Time.now
|
29
|
-
self.save!
|
30
|
-
|
31
|
-
!!(::TinyPassport::RegistrationMailer.send_confirmation_token(self.login_email).deliver)
|
32
|
-
else
|
33
|
-
false
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
# 校验 邮箱是否存在
|
38
|
-
def verify_login_email_present
|
39
|
-
if self.login_email_required?
|
40
|
-
unless self.login_email
|
41
|
-
self.errors.add :login_email_value, :not_found
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
47
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
module TinyPassport
|
3
|
-
class AccountService # 用户服务
|
4
|
-
include ::TinySupport::Serviceable
|
5
|
-
|
6
|
-
# TODO: 修改密码
|
7
|
-
def update_password_with_params params={}
|
8
|
-
form = ::TinyPassport::UpdatePasswordForm.new
|
9
|
-
form.submit params
|
10
|
-
form
|
11
|
-
end
|
12
|
-
|
13
|
-
# TODO: 重置密码
|
14
|
-
def reset_password_with_params params={}
|
15
|
-
form = ::TinyPassport::ResetPasswordForm.new
|
16
|
-
form.submit params
|
17
|
-
form
|
18
|
-
end
|
19
|
-
|
20
|
-
# TODO: 请求激活
|
21
|
-
def request_confirmation_token_with_params params={}
|
22
|
-
form = ::TinyPassport::ConfirmationTokenForm.new
|
23
|
-
form.submit params
|
24
|
-
form
|
25
|
-
end
|
26
|
-
|
27
|
-
# 生成一个重置密码的请求
|
28
|
-
# TODO:
|
29
|
-
def request_reset_password_with_params params={}
|
30
|
-
form = ::TinyPassport::ResetPasswordTokenForm.new
|
31
|
-
form.submit params
|
32
|
-
form
|
33
|
-
end
|
34
|
-
|
35
|
-
# 使用参数激活
|
36
|
-
def active_with_params params={}
|
37
|
-
form = ::TinyPassport::AccountActiveForm.new
|
38
|
-
form.submit params
|
39
|
-
form
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
module TinyPassport
|
3
|
-
# 邮箱发送服务
|
4
|
-
class EmailSendService
|
5
|
-
include ::TinySupport::Serviceable
|
6
|
-
|
7
|
-
# 用户激活后发送欢迎语
|
8
|
-
# TODO:
|
9
|
-
def send_welcome_for_active params={}
|
10
|
-
form = ::TinyPassport::WelcomeEmailForm.new
|
11
|
-
form.submit params
|
12
|
-
form
|
13
|
-
end
|
14
|
-
|
15
|
-
# 为login_email, 发送验证码
|
16
|
-
def send_confirmation_token_for_active params={}
|
17
|
-
form = ::TinyPassport::ConfirmationTokenForm.new
|
18
|
-
form.submit params
|
19
|
-
form
|
20
|
-
end
|
21
|
-
|
22
|
-
# 为了找回密码,来发送验证码
|
23
|
-
def send_confirmation_token_for_reset_password params={}
|
24
|
-
form = ::TinyPassport::RequestResetPasswordForm.new
|
25
|
-
form.submit params
|
26
|
-
form
|
27
|
-
end
|
28
|
-
|
29
|
-
private
|
30
|
-
|
31
|
-
end
|
32
|
-
end
|
Binary file
|
@@ -1 +0,0 @@
|
|
1
|
-
o: ActiveSupport::Cache::Entry:@valuei:@created_atf1390964231.656629:@expires_in0
|