Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
053a1988
Commit
053a1988
authored
Sep 13, 2017
by
Tiago Botelho
Committed by
Douwe Maan
Nov 20, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Impersonation no longer gets stuck on password change.
parent
7a61a8e0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
4 deletions
+34
-4
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+5
-1
changelogs/unreleased/1870-impersonation-stuck-on-password-change.yml
...nreleased/1870-impersonation-stuck-on-password-change.yml
+5
-0
spec/controllers/application_controller_spec.rb
spec/controllers/application_controller_spec.rb
+4
-0
spec/features/admin/admin_users_spec.rb
spec/features/admin/admin_users_spec.rb
+20
-3
No files found.
app/controllers/application_controller.rb
View file @
053a1988
...
...
@@ -196,7 +196,11 @@ class ApplicationController < ActionController::Base
end
def
check_password_expiration
if
current_user
&&
current_user
.
password_expires_at
&&
current_user
.
password_expires_at
<
Time
.
now
&&
!
current_user
.
ldap_user?
return
if
session
[
:impersonator_id
]
||
current_user
&
.
ldap_user?
password_expires_at
=
current_user
&
.
password_expires_at
if
password_expires_at
&&
password_expires_at
<
Time
.
now
return
redirect_to
new_profile_password_path
end
end
...
...
changelogs/unreleased/1870-impersonation-stuck-on-password-change.yml
0 → 100644
View file @
053a1988
---
title
:
Impersonation no longer gets stuck on password change.
merge_request
:
2904
author
:
type
:
fixed
spec/controllers/application_controller_spec.rb
View file @
053a1988
...
...
@@ -6,6 +6,10 @@ describe ApplicationController do
describe
'#check_password_expiration'
do
let
(
:controller
)
{
described_class
.
new
}
before
do
allow
(
controller
).
to
receive
(
:session
).
and_return
({})
end
it
'redirects if the user is over their password expiry'
do
user
.
password_expires_at
=
Time
.
new
(
2002
)
...
...
spec/features/admin/admin_users_spec.rb
View file @
053a1988
...
...
@@ -167,19 +167,36 @@ describe "Admin::Users" do
it
'sees impersonation log out icon'
do
icon
=
first
(
'.fa.fa-user-secret'
)
expect
(
icon
).
not_to
eql
nil
expect
(
icon
).
not_to
be
nil
end
it
'logs out of impersonated user back to original user'
do
find
(
:css
,
'li.impersonation a'
).
click
expect
(
page
.
find
(
:css
,
'.header-user .profile-link'
)[
'data-user'
]).
to
eq
l
(
current_user
.
username
)
expect
(
page
.
find
(
:css
,
'.header-user .profile-link'
)[
'data-user'
]).
to
eq
(
current_user
.
username
)
end
it
'is redirected back to the impersonated users page in the admin after stopping'
do
find
(
:css
,
'li.impersonation a'
).
click
expect
(
current_path
).
to
eql
"/admin/users/
#{
another_user
.
username
}
"
expect
(
current_path
).
to
eq
(
"/admin/users/
#{
another_user
.
username
}
"
)
end
end
context
'when impersonating a user with an expired password'
do
before
do
another_user
.
update
(
password_expires_at:
Time
.
now
-
5
.
minutes
)
click_link
'Impersonate'
end
it
'does not redirect to password change page'
do
expect
(
current_path
).
to
eq
(
'/'
)
end
it
'is redirected back to the impersonated users page in the admin after stopping'
do
find
(
:css
,
'li.impersonation a'
).
click
expect
(
current_path
).
to
eq
(
"/admin/users/
#{
another_user
.
username
}
"
)
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment