Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mastodon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pierre Boudes
mastodon
Commits
2a61f147
Unverified
Commit
2a61f147
authored
1 year ago
by
Claire
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix account confirmation flow not returning to app after captcha validation (#25057)
parent
8d6aea33
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/views/auth/confirmations/captcha.html.haml
+1
-0
1 addition, 0 deletions
app/views/auth/confirmations/captcha.html.haml
spec/features/captcha_spec.rb
+35
-0
35 additions, 0 deletions
spec/features/captcha_spec.rb
with
36 additions
and
0 deletions
app/views/auth/confirmations/captcha.html.haml
+
1
−
0
View file @
2a61f147
...
...
@@ -5,6 +5,7 @@
=
render
'auth/shared/progress'
,
stage:
'confirm'
=
hidden_field_tag
:confirmation_token
,
params
[
:confirmation_token
]
=
hidden_field_tag
:redirect_to_app
,
params
[
:redirect_to_app
]
%p
.lead
=
t
(
'auth.captcha_confirmation.hint_html'
)
...
...
This diff is collapsed.
Click to expand it.
spec/features/captcha_spec.rb
0 → 100644
+
35
−
0
View file @
2a61f147
# frozen_string_literal: true
require
'rails_helper'
describe
'email confirmation flow when captcha is enabled'
do
let
(
:user
)
{
Fabricate
(
:user
,
confirmed_at:
nil
,
confirmation_token:
'foobar'
,
created_by_application:
client_app
)
}
let
(
:client_app
)
{
nil
}
before
do
# rubocop:disable RSpec/AnyInstance -- easiest way to deal with that that I know of
allow_any_instance_of
(
Auth
::
ConfirmationsController
).
to
receive
(
:captcha_enabled?
).
and_return
(
true
)
allow_any_instance_of
(
Auth
::
ConfirmationsController
).
to
receive
(
:check_captcha!
).
and_return
(
true
)
allow_any_instance_of
(
Auth
::
ConfirmationsController
).
to
receive
(
:render_captcha
).
and_return
(
nil
)
# rubocop:enable RSpec/AnyInstance
end
context
'when the user signed up through an app'
do
let
(
:client_app
)
{
Fabricate
(
:application
)
}
it
'logs in'
do
visit
"/auth/confirmation?confirmation_token=
#{
user
.
confirmation_token
}
&redirect_to_app=true"
# It presents the user with a captcha form
expect
(
page
).
to
have_title
(
I18n
.
t
(
'auth.captcha_confirmation.title'
))
# It does not confirm the user just yet
expect
(
user
.
reload
.
confirmed?
).
to
be
false
# It redirects to app and confirms user
click_on
I18n
.
t
(
'challenge.confirm'
)
expect
(
user
.
reload
.
confirmed?
).
to
be
true
expect
(
page
).
to
have_current_path
(
/\A
#{
client_app
.
confirmation_redirect_uri
}
/
,
url:
true
)
end
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment