sorcery 0.17.0 → 0.18.0
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/CHANGELOG.md +4 -1
- data/README.md +8 -5
- data/lib/generators/sorcery/helpers.rb +1 -1
- data/lib/generators/sorcery/install_generator.rb +9 -18
- data/lib/generators/sorcery/templates/initializer.rb +24 -10
- data/lib/sorcery/adapters/active_record_adapter.rb +12 -14
- data/lib/sorcery/adapters/mongoid_adapter.rb +6 -8
- data/lib/sorcery/controller/config.rb +27 -29
- data/lib/sorcery/controller/submodules/activity_logging.rb +4 -7
- data/lib/sorcery/controller/submodules/brute_force_protection.rb +4 -1
- data/lib/sorcery/controller/submodules/external.rb +11 -11
- data/lib/sorcery/controller/submodules/http_basic_auth.rb +7 -2
- data/lib/sorcery/controller/submodules/remember_me.rb +2 -1
- data/lib/sorcery/controller/submodules/session_timeout.rb +2 -2
- data/lib/sorcery/controller.rb +36 -18
- data/lib/sorcery/crypto_providers/aes256.rb +4 -2
- data/lib/sorcery/crypto_providers/bcrypt.rb +2 -1
- data/lib/sorcery/crypto_providers/md5.rb +1 -0
- data/lib/sorcery/crypto_providers/sha1.rb +1 -0
- data/lib/sorcery/crypto_providers/sha256.rb +1 -0
- data/lib/sorcery/crypto_providers/sha512.rb +1 -0
- data/lib/sorcery/engine.rb +6 -4
- data/lib/sorcery/errors.rb +10 -0
- data/lib/sorcery/model/config.rb +20 -31
- data/lib/sorcery/model/submodules/activity_logging.rb +8 -6
- data/lib/sorcery/model/submodules/brute_force_protection.rb +16 -14
- data/lib/sorcery/model/submodules/external.rb +8 -10
- data/lib/sorcery/model/submodules/magic_login.rb +8 -4
- data/lib/sorcery/model/submodules/remember_me.rb +3 -3
- data/lib/sorcery/model/submodules/reset_password.rb +21 -13
- data/lib/sorcery/model/submodules/user_activation.rb +19 -17
- data/lib/sorcery/model/temporary_token.rb +5 -5
- data/lib/sorcery/model.rb +21 -25
- data/lib/sorcery/providers/base.rb +1 -1
- data/lib/sorcery/providers/facebook.rb +2 -2
- data/lib/sorcery/providers/github.rb +3 -3
- data/lib/sorcery/providers/heroku.rb +1 -2
- data/lib/sorcery/providers/jira.rb +3 -2
- data/lib/sorcery/providers/line.rb +2 -4
- data/lib/sorcery/providers/microsoft.rb +1 -1
- data/lib/sorcery/providers/twitter.rb +2 -2
- data/lib/sorcery/providers/vk.rb +4 -4
- data/lib/sorcery/providers/xing.rb +3 -2
- data/lib/sorcery/test_helpers/internal/rails.rb +5 -22
- data/lib/sorcery/test_helpers/internal.rb +4 -6
- data/lib/sorcery/test_helpers/rails/integration.rb +1 -1
- data/lib/sorcery/test_helpers/rails/request.rb +1 -1
- data/lib/sorcery/version.rb +1 -1
- data/lib/sorcery.rb +6 -1
- metadata +21 -150
- data/.devcontainer/Dockerfile +0 -10
- data/.devcontainer/devcontainer.json +0 -29
- data/.devcontainer/postcreate.sh +0 -4
- data/.document +0 -5
- data/.github/FUNDING.yml +0 -1
- data/.github/ISSUE_TEMPLATE.md +0 -24
- data/.github/PULL_REQUEST_TEMPLATE.md +0 -7
- data/.github/workflows/ruby.yml +0 -54
- data/.gitignore +0 -60
- data/.rspec +0 -1
- data/.rubocop.yml +0 -55
- data/.rubocop_todo.yml +0 -163
- data/CODE_OF_CONDUCT.md +0 -14
- data/Gemfile +0 -8
- data/MAINTAINING.md +0 -64
- data/Rakefile +0 -8
- data/SECURITY.md +0 -19
- data/gemfiles/rails_61.gemfile +0 -7
- data/gemfiles/rails_70.gemfile +0 -7
- data/gemfiles/rails_71.gemfile +0 -7
- data/sorcery.gemspec +0 -49
- data/spec/active_record/user_activation_spec.rb +0 -17
- data/spec/active_record/user_activity_logging_spec.rb +0 -15
- data/spec/active_record/user_brute_force_protection_spec.rb +0 -15
- data/spec/active_record/user_magic_login_spec.rb +0 -15
- data/spec/active_record/user_oauth_spec.rb +0 -15
- data/spec/active_record/user_remember_me_spec.rb +0 -15
- data/spec/active_record/user_reset_password_spec.rb +0 -15
- data/spec/active_record/user_spec.rb +0 -27
- data/spec/controllers/controller_activity_logging_spec.rb +0 -113
- data/spec/controllers/controller_brute_force_protection_spec.rb +0 -41
- data/spec/controllers/controller_http_basic_auth_spec.rb +0 -67
- data/spec/controllers/controller_oauth2_spec.rb +0 -568
- data/spec/controllers/controller_oauth_spec.rb +0 -266
- data/spec/controllers/controller_remember_me_spec.rb +0 -130
- data/spec/controllers/controller_session_timeout_spec.rb +0 -168
- data/spec/controllers/controller_spec.rb +0 -200
- data/spec/orm/active_record.rb +0 -21
- data/spec/providers/example_provider_spec.rb +0 -17
- data/spec/providers/example_spec.rb +0 -17
- data/spec/providers/examples_spec.rb +0 -17
- data/spec/providers/vk_spec.rb +0 -42
- data/spec/rails_app/app/active_record/authentication.rb +0 -3
- data/spec/rails_app/app/active_record/user.rb +0 -5
- data/spec/rails_app/app/active_record/user_provider.rb +0 -3
- data/spec/rails_app/app/assets/config/manifest.js +0 -1
- data/spec/rails_app/app/controllers/application_controller.rb +0 -2
- data/spec/rails_app/app/controllers/sorcery_controller.rb +0 -489
- data/spec/rails_app/app/helpers/application_helper.rb +0 -2
- data/spec/rails_app/app/mailers/sorcery_mailer.rb +0 -38
- data/spec/rails_app/app/views/application/index.html.erb +0 -17
- data/spec/rails_app/app/views/layouts/application.html.erb +0 -14
- data/spec/rails_app/app/views/sorcery_mailer/activation_email.html.erb +0 -17
- data/spec/rails_app/app/views/sorcery_mailer/activation_email.text.erb +0 -9
- data/spec/rails_app/app/views/sorcery_mailer/activation_needed_email.html.erb +0 -17
- data/spec/rails_app/app/views/sorcery_mailer/activation_success_email.html.erb +0 -17
- data/spec/rails_app/app/views/sorcery_mailer/activation_success_email.text.erb +0 -9
- data/spec/rails_app/app/views/sorcery_mailer/magic_login_email.html.erb +0 -13
- data/spec/rails_app/app/views/sorcery_mailer/magic_login_email.text.erb +0 -6
- data/spec/rails_app/app/views/sorcery_mailer/reset_password_email.html.erb +0 -16
- data/spec/rails_app/app/views/sorcery_mailer/reset_password_email.text.erb +0 -8
- data/spec/rails_app/app/views/sorcery_mailer/send_unlock_token_email.text.erb +0 -1
- data/spec/rails_app/config/application.rb +0 -61
- data/spec/rails_app/config/boot.rb +0 -4
- data/spec/rails_app/config/database.yml +0 -22
- data/spec/rails_app/config/environment.rb +0 -5
- data/spec/rails_app/config/environments/test.rb +0 -37
- data/spec/rails_app/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/rails_app/config/initializers/compatible_legacy_migration.rb +0 -11
- data/spec/rails_app/config/initializers/inflections.rb +0 -10
- data/spec/rails_app/config/initializers/mime_types.rb +0 -5
- data/spec/rails_app/config/initializers/session_store.rb +0 -12
- data/spec/rails_app/config/locales/en.yml +0 -5
- data/spec/rails_app/config/routes.rb +0 -81
- data/spec/rails_app/config/secrets.yml +0 -4
- data/spec/rails_app/config.ru +0 -4
- data/spec/rails_app/db/migrate/activation/20101224223622_add_activation_to_users.rb +0 -17
- data/spec/rails_app/db/migrate/activity_logging/20101224223624_add_activity_logging_to_users.rb +0 -19
- data/spec/rails_app/db/migrate/brute_force_protection/20101224223626_add_brute_force_protection_to_users.rb +0 -13
- data/spec/rails_app/db/migrate/core/20101224223620_create_users.rb +0 -16
- data/spec/rails_app/db/migrate/external/20101224223628_create_authentications_and_user_providers.rb +0 -22
- data/spec/rails_app/db/migrate/invalidate_active_sessions/20180221093235_add_invalidate_active_sessions_before_to_users.rb +0 -9
- data/spec/rails_app/db/migrate/magic_login/20170924151831_add_magic_login_to_users.rb +0 -17
- data/spec/rails_app/db/migrate/remember_me/20101224223623_add_remember_me_token_to_users.rb +0 -15
- data/spec/rails_app/db/migrate/reset_password/20101224223622_add_reset_password_to_users.rb +0 -15
- data/spec/rails_app/db/schema.rb +0 -21
- data/spec/rails_app/db/seeds.rb +0 -7
- data/spec/shared_examples/user_activation_shared_examples.rb +0 -361
- data/spec/shared_examples/user_activity_logging_shared_examples.rb +0 -106
- data/spec/shared_examples/user_brute_force_protection_shared_examples.rb +0 -151
- data/spec/shared_examples/user_magic_login_shared_examples.rb +0 -150
- data/spec/shared_examples/user_oauth_shared_examples.rb +0 -33
- data/spec/shared_examples/user_remember_me_shared_examples.rb +0 -129
- data/spec/shared_examples/user_reset_password_shared_examples.rb +0 -370
- data/spec/shared_examples/user_shared_examples.rb +0 -678
- data/spec/sorcery_crypto_providers_spec.rb +0 -245
- data/spec/sorcery_temporary_token_spec.rb +0 -27
- data/spec/spec.opts +0 -2
- data/spec/spec_helper.rb +0 -50
- data/spec/support/migration_helper.rb +0 -29
- data/spec/support/providers/example.rb +0 -11
- data/spec/support/providers/example_provider.rb +0 -11
- data/spec/support/providers/examples.rb +0 -11
|
@@ -1,489 +0,0 @@
|
|
|
1
|
-
require 'oauth'
|
|
2
|
-
|
|
3
|
-
class SorceryController < ApplicationController
|
|
4
|
-
protect_from_forgery
|
|
5
|
-
|
|
6
|
-
before_action :require_login_from_http_basic, only: [:test_http_basic_auth]
|
|
7
|
-
before_action :require_login, only: %i[
|
|
8
|
-
test_logout
|
|
9
|
-
test_logout_with_forget_me
|
|
10
|
-
test_logout_with_force_forget_me
|
|
11
|
-
test_should_be_logged_in
|
|
12
|
-
some_action
|
|
13
|
-
]
|
|
14
|
-
|
|
15
|
-
def index; end
|
|
16
|
-
|
|
17
|
-
def some_action
|
|
18
|
-
head :ok
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def some_action_making_a_non_persisted_change_to_the_user
|
|
22
|
-
current_user.email = 'to_be_ignored'
|
|
23
|
-
head :ok
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def test_login
|
|
27
|
-
@user = login(params[:email], params[:password])
|
|
28
|
-
head :ok
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def test_auto_login
|
|
32
|
-
@user = User.first
|
|
33
|
-
auto_login(@user)
|
|
34
|
-
@result = current_user
|
|
35
|
-
head :ok
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def test_return_to
|
|
39
|
-
@user = login(params[:email], params[:password])
|
|
40
|
-
redirect_back_or_to(:index, notice: 'haha!')
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
def test_logout
|
|
44
|
-
logout
|
|
45
|
-
head :ok
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def test_logout_with_remember
|
|
49
|
-
remember_me!
|
|
50
|
-
logout
|
|
51
|
-
head :ok
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
def test_logout_with_forget_me
|
|
55
|
-
remember_me!
|
|
56
|
-
forget_me!
|
|
57
|
-
logout
|
|
58
|
-
head :ok
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
def test_logout_with_force_forget_me
|
|
62
|
-
remember_me!
|
|
63
|
-
force_forget_me!
|
|
64
|
-
logout
|
|
65
|
-
head :ok
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
def test_invalidate_active_session
|
|
69
|
-
invalidate_active_sessions!
|
|
70
|
-
head :ok
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
def test_login_with_remember
|
|
74
|
-
@user = login(params[:email], params[:password])
|
|
75
|
-
remember_me!
|
|
76
|
-
|
|
77
|
-
head :ok
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
def test_login_with_remember_in_login
|
|
81
|
-
@user = login(params[:email], params[:password], params[:remember])
|
|
82
|
-
|
|
83
|
-
head :ok
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
def test_login_from_cookie
|
|
87
|
-
@user = current_user
|
|
88
|
-
head :ok
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
def test_not_authenticated_action
|
|
92
|
-
head :ok
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
def test_should_be_logged_in
|
|
96
|
-
head :ok
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
def test_http_basic_auth
|
|
100
|
-
head :ok
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
def login_at_test_twitter
|
|
104
|
-
login_at(:twitter)
|
|
105
|
-
end
|
|
106
|
-
|
|
107
|
-
alias login_at_test login_at_test_twitter
|
|
108
|
-
|
|
109
|
-
def login_at_test_facebook
|
|
110
|
-
login_at(:facebook)
|
|
111
|
-
end
|
|
112
|
-
|
|
113
|
-
def login_at_test_github
|
|
114
|
-
login_at(:github)
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
def login_at_test_paypal
|
|
118
|
-
login_at(:paypal)
|
|
119
|
-
end
|
|
120
|
-
|
|
121
|
-
def login_at_test_wechat
|
|
122
|
-
login_at(:wechat)
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
def login_at_test_microsoft
|
|
126
|
-
login_at(:microsoft)
|
|
127
|
-
end
|
|
128
|
-
|
|
129
|
-
def login_at_test_google
|
|
130
|
-
login_at(:google)
|
|
131
|
-
end
|
|
132
|
-
|
|
133
|
-
def login_at_test_liveid
|
|
134
|
-
login_at(:liveid)
|
|
135
|
-
end
|
|
136
|
-
|
|
137
|
-
def login_at_test_jira
|
|
138
|
-
login_at(:jira)
|
|
139
|
-
end
|
|
140
|
-
|
|
141
|
-
def login_at_test_vk
|
|
142
|
-
login_at(:vk)
|
|
143
|
-
end
|
|
144
|
-
|
|
145
|
-
def login_at_test_salesforce
|
|
146
|
-
login_at(:salesforce)
|
|
147
|
-
end
|
|
148
|
-
|
|
149
|
-
def login_at_test_slack
|
|
150
|
-
login_at(:slack)
|
|
151
|
-
end
|
|
152
|
-
|
|
153
|
-
def login_at_test_line
|
|
154
|
-
login_at(:line)
|
|
155
|
-
end
|
|
156
|
-
|
|
157
|
-
def login_at_test_with_state
|
|
158
|
-
login_at(:facebook, state: 'bla')
|
|
159
|
-
end
|
|
160
|
-
|
|
161
|
-
def login_at_test_instagram
|
|
162
|
-
login_at(:instagram)
|
|
163
|
-
end
|
|
164
|
-
|
|
165
|
-
def login_at_test_auth0
|
|
166
|
-
login_at(:auth0)
|
|
167
|
-
end
|
|
168
|
-
|
|
169
|
-
def login_at_test_discord
|
|
170
|
-
login_at(:discord)
|
|
171
|
-
end
|
|
172
|
-
|
|
173
|
-
def login_at_test_battlenet
|
|
174
|
-
login_at(:battlenet)
|
|
175
|
-
end
|
|
176
|
-
|
|
177
|
-
def test_login_from_twitter
|
|
178
|
-
if (@user = login_from(:twitter))
|
|
179
|
-
redirect_to 'bla', notice: 'Success!'
|
|
180
|
-
else
|
|
181
|
-
redirect_to 'blu', alert: 'Failed!'
|
|
182
|
-
end
|
|
183
|
-
end
|
|
184
|
-
|
|
185
|
-
alias test_login_from test_login_from_twitter
|
|
186
|
-
|
|
187
|
-
def test_login_from_facebook
|
|
188
|
-
if (@user = login_from(:facebook))
|
|
189
|
-
redirect_to 'bla', notice: 'Success!'
|
|
190
|
-
else
|
|
191
|
-
redirect_to 'blu', alert: 'Failed!'
|
|
192
|
-
end
|
|
193
|
-
end
|
|
194
|
-
|
|
195
|
-
def test_login_from_github
|
|
196
|
-
if (@user = login_from(:github))
|
|
197
|
-
redirect_to 'bla', notice: 'Success!'
|
|
198
|
-
else
|
|
199
|
-
redirect_to 'blu', alert: 'Failed!'
|
|
200
|
-
end
|
|
201
|
-
end
|
|
202
|
-
|
|
203
|
-
def test_login_from_paypal
|
|
204
|
-
if (@user = login_from(:paypal))
|
|
205
|
-
redirect_to 'bla', notice: 'Success!'
|
|
206
|
-
else
|
|
207
|
-
redirect_to 'blu', alert: 'Failed!'
|
|
208
|
-
end
|
|
209
|
-
end
|
|
210
|
-
|
|
211
|
-
def test_login_from_wechat
|
|
212
|
-
if (@user = login_from(:wechat))
|
|
213
|
-
redirect_to 'bla', notice: 'Success!'
|
|
214
|
-
else
|
|
215
|
-
redirect_to 'blu', alert: 'Failed!'
|
|
216
|
-
end
|
|
217
|
-
end
|
|
218
|
-
|
|
219
|
-
def test_login_from_microsoft
|
|
220
|
-
if (@user = login_from(:microsoft))
|
|
221
|
-
redirect_to 'bla', notice: 'Success!'
|
|
222
|
-
else
|
|
223
|
-
redirect_to 'blu', alert: 'Failed!'
|
|
224
|
-
end
|
|
225
|
-
end
|
|
226
|
-
|
|
227
|
-
def test_login_from_google
|
|
228
|
-
if (@user = login_from(:google))
|
|
229
|
-
redirect_to 'bla', notice: 'Success!'
|
|
230
|
-
else
|
|
231
|
-
redirect_to 'blu', alert: 'Failed!'
|
|
232
|
-
end
|
|
233
|
-
end
|
|
234
|
-
|
|
235
|
-
def test_login_from_liveid
|
|
236
|
-
if (@user = login_from(:liveid))
|
|
237
|
-
redirect_to 'bla', notice: 'Success!'
|
|
238
|
-
else
|
|
239
|
-
redirect_to 'blu', alert: 'Failed!'
|
|
240
|
-
end
|
|
241
|
-
end
|
|
242
|
-
|
|
243
|
-
def test_login_from_vk
|
|
244
|
-
if (@user = login_from(:vk))
|
|
245
|
-
redirect_to 'bla', notice: 'Success!'
|
|
246
|
-
else
|
|
247
|
-
redirect_to 'blu', alert: 'Failed!'
|
|
248
|
-
end
|
|
249
|
-
end
|
|
250
|
-
|
|
251
|
-
def test_login_from_jira
|
|
252
|
-
if (@user = login_from(:jira))
|
|
253
|
-
redirect_to 'bla', notice: 'Success!'
|
|
254
|
-
else
|
|
255
|
-
redirect_to 'blu', alert: 'Failed!'
|
|
256
|
-
end
|
|
257
|
-
end
|
|
258
|
-
|
|
259
|
-
def test_login_from_salesforce
|
|
260
|
-
if (@user = login_from(:salesforce))
|
|
261
|
-
redirect_to 'bla', notice: 'Success!'
|
|
262
|
-
else
|
|
263
|
-
redirect_to 'blu', alert: 'Failed!'
|
|
264
|
-
end
|
|
265
|
-
end
|
|
266
|
-
|
|
267
|
-
def test_login_from_slack
|
|
268
|
-
if (@user = login_from(:slack))
|
|
269
|
-
redirect_to 'bla', notice: 'Success!'
|
|
270
|
-
else
|
|
271
|
-
redirect_to 'blu', alert: 'Failed!'
|
|
272
|
-
end
|
|
273
|
-
end
|
|
274
|
-
|
|
275
|
-
def test_login_from_instagram
|
|
276
|
-
if (@user = login_from(:instagram))
|
|
277
|
-
redirect_to 'bla', notice: 'Success!'
|
|
278
|
-
else
|
|
279
|
-
redirect_to 'blu', alert: 'Failed!'
|
|
280
|
-
end
|
|
281
|
-
end
|
|
282
|
-
|
|
283
|
-
def test_login_from_auth0
|
|
284
|
-
if (@user = login_from(:auth0))
|
|
285
|
-
redirect_to 'bla', notice: 'Success!'
|
|
286
|
-
else
|
|
287
|
-
redirect_to 'blu', alert: 'Failed!'
|
|
288
|
-
end
|
|
289
|
-
end
|
|
290
|
-
|
|
291
|
-
def test_login_from_line
|
|
292
|
-
if @user = login_from(:line)
|
|
293
|
-
redirect_to 'bla', notice: 'Success!'
|
|
294
|
-
else
|
|
295
|
-
redirect_to 'blu', alert: 'Failed!'
|
|
296
|
-
end
|
|
297
|
-
end
|
|
298
|
-
|
|
299
|
-
def test_login_from_discord
|
|
300
|
-
if (@user = login_from(:discord))
|
|
301
|
-
redirect_to 'bla', notice: 'Success!'
|
|
302
|
-
else
|
|
303
|
-
redirect_to 'blu', alert: 'Failed!'
|
|
304
|
-
end
|
|
305
|
-
end
|
|
306
|
-
|
|
307
|
-
def test_login_from_battlenet
|
|
308
|
-
if (@user = login_from(:battlenet))
|
|
309
|
-
redirect_to 'bla', notice: 'Success!'
|
|
310
|
-
else
|
|
311
|
-
redirect_to 'blu', alert: 'Failed!'
|
|
312
|
-
end
|
|
313
|
-
end
|
|
314
|
-
|
|
315
|
-
def test_return_to_with_external_twitter
|
|
316
|
-
if (@user = login_from(:twitter))
|
|
317
|
-
redirect_back_or_to 'bla', notice: 'Success!'
|
|
318
|
-
else
|
|
319
|
-
redirect_to 'blu', alert: 'Failed!'
|
|
320
|
-
end
|
|
321
|
-
end
|
|
322
|
-
|
|
323
|
-
def test_return_to_with_external_jira
|
|
324
|
-
if (@user = login_from(:jira))
|
|
325
|
-
redirect_back_or_to 'bla', notice: 'Success!'
|
|
326
|
-
else
|
|
327
|
-
redirect_to 'blu', alert: 'Failed!'
|
|
328
|
-
end
|
|
329
|
-
end
|
|
330
|
-
|
|
331
|
-
alias test_return_to_with_external test_return_to_with_external_twitter
|
|
332
|
-
|
|
333
|
-
def test_return_to_with_external_facebook
|
|
334
|
-
if (@user = login_from(:facebook))
|
|
335
|
-
redirect_back_or_to 'bla', notice: 'Success!'
|
|
336
|
-
else
|
|
337
|
-
redirect_to 'blu', alert: 'Failed!'
|
|
338
|
-
end
|
|
339
|
-
end
|
|
340
|
-
|
|
341
|
-
def test_return_to_with_external_github
|
|
342
|
-
if (@user = login_from(:github))
|
|
343
|
-
redirect_back_or_to 'bla', notice: 'Success!'
|
|
344
|
-
else
|
|
345
|
-
redirect_to 'blu', alert: 'Failed!'
|
|
346
|
-
end
|
|
347
|
-
end
|
|
348
|
-
|
|
349
|
-
def test_return_to_with_external_paypal
|
|
350
|
-
if (@user = login_from(:paypal))
|
|
351
|
-
redirect_back_or_to 'bla', notice: 'Success!'
|
|
352
|
-
else
|
|
353
|
-
redirect_to 'blu', alert: 'Failed!'
|
|
354
|
-
end
|
|
355
|
-
end
|
|
356
|
-
|
|
357
|
-
def test_return_to_with_external_wechat
|
|
358
|
-
if (@user = login_from(:wechat))
|
|
359
|
-
redirect_back_or_to 'bla', notice: 'Success!'
|
|
360
|
-
else
|
|
361
|
-
redirect_to 'blu', alert: 'Failed!'
|
|
362
|
-
end
|
|
363
|
-
end
|
|
364
|
-
|
|
365
|
-
def test_return_to_with_external_microsoft
|
|
366
|
-
if (@user = login_from(:microsoft))
|
|
367
|
-
redirect_back_or_to 'bla', notice: 'Success!'
|
|
368
|
-
else
|
|
369
|
-
redirect_to 'blu', alert: 'Failed!'
|
|
370
|
-
end
|
|
371
|
-
end
|
|
372
|
-
|
|
373
|
-
def test_return_to_with_external_google
|
|
374
|
-
if (@user = login_from(:google))
|
|
375
|
-
redirect_back_or_to 'bla', notice: 'Success!'
|
|
376
|
-
else
|
|
377
|
-
redirect_to 'blu', alert: 'Failed!'
|
|
378
|
-
end
|
|
379
|
-
end
|
|
380
|
-
|
|
381
|
-
def test_return_to_with_external_liveid
|
|
382
|
-
if (@user = login_from(:liveid))
|
|
383
|
-
redirect_back_or_to 'bla', notice: 'Success!'
|
|
384
|
-
else
|
|
385
|
-
redirect_to 'blu', alert: 'Failed!'
|
|
386
|
-
end
|
|
387
|
-
end
|
|
388
|
-
|
|
389
|
-
def test_return_to_with_external_vk
|
|
390
|
-
if (@user = login_from(:vk))
|
|
391
|
-
redirect_back_or_to 'bla', notice: 'Success!'
|
|
392
|
-
else
|
|
393
|
-
redirect_to 'blu', alert: 'Failed!'
|
|
394
|
-
end
|
|
395
|
-
end
|
|
396
|
-
|
|
397
|
-
def test_return_to_with_external_salesforce
|
|
398
|
-
if (@user = login_from(:salesforce))
|
|
399
|
-
redirect_back_or_to 'bla', notice: 'Success!'
|
|
400
|
-
else
|
|
401
|
-
redirect_to 'blu', alert: 'Failed!'
|
|
402
|
-
end
|
|
403
|
-
end
|
|
404
|
-
|
|
405
|
-
def test_return_to_with_external_slack
|
|
406
|
-
if (@user = login_from(:slack))
|
|
407
|
-
redirect_back_or_to 'bla', notice: 'Success!'
|
|
408
|
-
else
|
|
409
|
-
redirect_to 'blu', alert: 'Failed!'
|
|
410
|
-
end
|
|
411
|
-
end
|
|
412
|
-
|
|
413
|
-
def test_return_to_with_external_instagram
|
|
414
|
-
if (@user = login_from(:instagram))
|
|
415
|
-
redirect_back_or_to 'bla', notice: 'Success!'
|
|
416
|
-
else
|
|
417
|
-
redirect_to 'blu', alert: 'Failed!'
|
|
418
|
-
end
|
|
419
|
-
end
|
|
420
|
-
|
|
421
|
-
def test_return_to_with_external_auth0
|
|
422
|
-
if (@user = login_from(:auth0))
|
|
423
|
-
redirect_back_or_to 'bla', notice: 'Success!'
|
|
424
|
-
else
|
|
425
|
-
redirect_to 'blu', alert: 'Failed!'
|
|
426
|
-
end
|
|
427
|
-
end
|
|
428
|
-
|
|
429
|
-
def test_return_to_with_external_line
|
|
430
|
-
if @user = login_from(:line)
|
|
431
|
-
redirect_back_or_to 'bla', notice: 'Success!'
|
|
432
|
-
else
|
|
433
|
-
redirect_to 'blu', alert: 'Failed!'
|
|
434
|
-
end
|
|
435
|
-
end
|
|
436
|
-
|
|
437
|
-
def test_return_to_with_external_discord
|
|
438
|
-
if (@user = login_from(:discord))
|
|
439
|
-
redirect_back_or_to 'bla', notice: 'Success!'
|
|
440
|
-
else
|
|
441
|
-
redirect_to 'blu', alert: 'Failed!'
|
|
442
|
-
end
|
|
443
|
-
end
|
|
444
|
-
|
|
445
|
-
def test_return_to_with_external_battlenet
|
|
446
|
-
if (@user = login_from(:battlenet))
|
|
447
|
-
redirect_back_or_to 'bla', notice: 'Success!'
|
|
448
|
-
else
|
|
449
|
-
redirect_to 'blu', alert: 'Failed!'
|
|
450
|
-
end
|
|
451
|
-
end
|
|
452
|
-
|
|
453
|
-
def test_create_from_provider
|
|
454
|
-
provider = params[:provider]
|
|
455
|
-
login_from(provider)
|
|
456
|
-
if (@user = create_from(provider))
|
|
457
|
-
redirect_to 'bla', notice: 'Success!'
|
|
458
|
-
else
|
|
459
|
-
redirect_to 'blu', alert: 'Failed!'
|
|
460
|
-
end
|
|
461
|
-
end
|
|
462
|
-
|
|
463
|
-
def test_add_second_provider
|
|
464
|
-
provider = params[:provider]
|
|
465
|
-
|
|
466
|
-
return unless logged_in?
|
|
467
|
-
|
|
468
|
-
if (@user = add_provider_to_user(provider))
|
|
469
|
-
redirect_to 'bla', notice: 'Success!'
|
|
470
|
-
else
|
|
471
|
-
redirect_to 'blu', alert: 'Failed!'
|
|
472
|
-
end
|
|
473
|
-
end
|
|
474
|
-
|
|
475
|
-
def test_create_from_provider_with_block
|
|
476
|
-
provider = params[:provider]
|
|
477
|
-
login_from(provider)
|
|
478
|
-
@user = create_from(provider) do |_user|
|
|
479
|
-
# check uniqueness of email
|
|
480
|
-
# User.where(email: user.email).empty?
|
|
481
|
-
false
|
|
482
|
-
end
|
|
483
|
-
if @user
|
|
484
|
-
redirect_to 'bla', notice: 'Success!'
|
|
485
|
-
else
|
|
486
|
-
redirect_to 'blu', alert: 'Failed!'
|
|
487
|
-
end
|
|
488
|
-
end
|
|
489
|
-
end
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
class SorceryMailer < ActionMailer::Base
|
|
2
|
-
default from: 'notifications@example.com'
|
|
3
|
-
|
|
4
|
-
def activation_needed_email(user)
|
|
5
|
-
@user = user
|
|
6
|
-
@url = 'http://example.com/login'
|
|
7
|
-
mail(to: user.email,
|
|
8
|
-
subject: 'Welcome to My Awesome Site')
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def activation_success_email(user)
|
|
12
|
-
@user = user
|
|
13
|
-
@url = 'http://example.com/login'
|
|
14
|
-
mail(to: user.email,
|
|
15
|
-
subject: 'Your account is now activated')
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def reset_password_email(user)
|
|
19
|
-
@user = user
|
|
20
|
-
@url = 'http://example.com/login'
|
|
21
|
-
mail(to: user.email,
|
|
22
|
-
subject: 'Your password has been reset')
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def send_unlock_token_email(user)
|
|
26
|
-
@user = user
|
|
27
|
-
@url = "http://example.com/unlock/#{user.unlock_token}"
|
|
28
|
-
mail(to: user.email,
|
|
29
|
-
subject: 'Your account has been locked due to many wrong logins')
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def magic_login_email(user)
|
|
33
|
-
@user = user
|
|
34
|
-
@url = 'http://example.com/login'
|
|
35
|
-
mail(to: user.email,
|
|
36
|
-
subject: 'Magic Login')
|
|
37
|
-
end
|
|
38
|
-
end
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<%= form_tag :action => :test_login, :method => :post do %>
|
|
2
|
-
<div class="field">
|
|
3
|
-
<%= label_tag :username %><br />
|
|
4
|
-
<%= text_field_tag :username %>
|
|
5
|
-
</div>
|
|
6
|
-
<div class="field">
|
|
7
|
-
<%= label_tag :password %><br />
|
|
8
|
-
<%= password_field_tag :password %>
|
|
9
|
-
</div>
|
|
10
|
-
<div class="actions">
|
|
11
|
-
<%= submit_tag "Login" %>
|
|
12
|
-
</div>
|
|
13
|
-
<div>
|
|
14
|
-
<%= label_tag "keep me logged in" %><br />
|
|
15
|
-
<%= check_box_tag :remember %>
|
|
16
|
-
</div>
|
|
17
|
-
<% end %>
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
|
5
|
-
</head>
|
|
6
|
-
<body>
|
|
7
|
-
<h1>Welcome to example.com, <%= @user.username %></h1>
|
|
8
|
-
<p>
|
|
9
|
-
You have successfully signed up to example.com,
|
|
10
|
-
your username is: <%= @user.username %>.<br/>
|
|
11
|
-
</p>
|
|
12
|
-
<p>
|
|
13
|
-
To login to the site, just follow this link: <%= @url %>.
|
|
14
|
-
</p>
|
|
15
|
-
<p>Thanks for joining and have a great day!</p>
|
|
16
|
-
</body>
|
|
17
|
-
</html>
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
Welcome to example.com, <%= @user.username %>
|
|
2
|
-
===============================================
|
|
3
|
-
|
|
4
|
-
You have successfully signed up to example.com,
|
|
5
|
-
your username is: <%= @user.username %>.
|
|
6
|
-
|
|
7
|
-
To login to the site, just follow this link: <%= @url %>.
|
|
8
|
-
|
|
9
|
-
Thanks for joining and have a great day!
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
|
5
|
-
</head>
|
|
6
|
-
<body>
|
|
7
|
-
<h1>Congratz, <%= @user.username %></h1>
|
|
8
|
-
<p>
|
|
9
|
-
You have successfully activated your example.com account,
|
|
10
|
-
your username is: <%= @user.username %>.<br/>
|
|
11
|
-
</p>
|
|
12
|
-
<p>
|
|
13
|
-
To login to the site, just follow this link: <%= @url %>.
|
|
14
|
-
</p>
|
|
15
|
-
<p>Thanks for joining and have a great day!</p>
|
|
16
|
-
</body>
|
|
17
|
-
</html>
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
|
5
|
-
</head>
|
|
6
|
-
<body>
|
|
7
|
-
<h1>Congratz, <%= @user.username %></h1>
|
|
8
|
-
<p>
|
|
9
|
-
You have successfully activated your example.com account,
|
|
10
|
-
your username is: <%= @user.username %>.<br/>
|
|
11
|
-
</p>
|
|
12
|
-
<p>
|
|
13
|
-
To login to the site, just follow this link: <%= @url %>.
|
|
14
|
-
</p>
|
|
15
|
-
<p>Thanks for joining and have a great day!</p>
|
|
16
|
-
</body>
|
|
17
|
-
</html>
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
Congratz, <%= @user.username %>
|
|
2
|
-
===============================================
|
|
3
|
-
|
|
4
|
-
You have successfully activated your example.com account,
|
|
5
|
-
your username is: <%= @user.username %>.
|
|
6
|
-
|
|
7
|
-
To login to the site, just follow this link: <%= @url %>.
|
|
8
|
-
|
|
9
|
-
Thanks for joining and have a great day!
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
|
5
|
-
</head>
|
|
6
|
-
<body>
|
|
7
|
-
<h1>Hello, <%= @user.username %></h1>
|
|
8
|
-
<p>
|
|
9
|
-
To login without a password, just follow this link: <%= @url %>.
|
|
10
|
-
</p>
|
|
11
|
-
<p>Have a great day!</p>
|
|
12
|
-
</body>
|
|
13
|
-
</html>
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
|
5
|
-
</head>
|
|
6
|
-
<body>
|
|
7
|
-
<h1>Hello, <%= @user.username %></h1>
|
|
8
|
-
<p>
|
|
9
|
-
You have requested to reset your password.
|
|
10
|
-
</p>
|
|
11
|
-
<p>
|
|
12
|
-
To choose a new password, just follow this link: <%= @url %>.
|
|
13
|
-
</p>
|
|
14
|
-
<p>Have a great day!</p>
|
|
15
|
-
</body>
|
|
16
|
-
</html>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Please visit <%= @url %> for unlock your account.
|