BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
ca1b67ce
Commit
ca1b67ce
authored
Sep 17, 2013
by
Izaak Alpert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't show users password change page if ldap users
parent
16b6040c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
1 deletion
+41
-1
application_controller.rb
app/controllers/application_controller.rb
+1
-1
profile.feature
features/profile/profile.feature
+1
-0
profile.rb
features/steps/profile/profile.rb
+5
-0
application_controller_spec.rb
spec/controllers/application_controller_spec.rb
+34
-0
No files found.
app/controllers/application_controller.rb
View file @
ca1b67ce
...
...
@@ -151,7 +151,7 @@ class ApplicationController < ActionController::Base
end
def
check_password_expiration
if
current_user
&&
current_user
.
password_expires_at
&&
current_user
.
password_expires_at
<
Time
.
now
if
current_user
&&
current_user
.
password_expires_at
&&
current_user
.
password_expires_at
<
Time
.
now
&&
!
current_user
.
ldap_user?
redirect_to
new_profile_password_path
and
return
end
end
...
...
features/profile/profile.feature
View file @
ca1b67ce
...
...
@@ -18,6 +18,7 @@ Feature: Profile
Scenario
:
My password is expired
Given
my password is expired
And
I am not an ldap user
And
I visit profile account page
Then
I redirected to expired password page
And
I submit new password
...
...
features/steps/profile/profile.rb
View file @
ca1b67ce
...
...
@@ -91,6 +91,11 @@ class Profile < Spinach::FeatureSteps
current_user
.
update_attributes
(
password_expires_at:
Time
.
now
-
1
.
hour
)
end
step
"I am not an ldap user"
do
current_user
.
update_attributes
(
extern_uid:
nil
,
provider:
''
)
current_user
.
ldap_user?
.
should
be_false
end
step
'I redirected to expired password page'
do
current_path
.
should
==
new_profile_password_path
end
...
...
spec/controllers/application_controller_spec.rb
0 → 100644
View file @
ca1b67ce
require
'spec_helper'
describe
ApplicationController
do
describe
'#check_password_expiration'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:controller
)
{
ApplicationController
.
new
}
it
'should redirect if the user is over their password expiry'
do
user
.
password_expires_at
=
Time
.
new
(
2002
)
user
.
ldap_user?
.
should
be_false
controller
.
stub!
(
:current_user
).
and_return
(
user
)
controller
.
should_receive
(
:redirect_to
)
controller
.
should_receive
(
:new_profile_password_path
)
controller
.
send
(
:check_password_expiration
)
end
it
'should not redirect if the user is under their password expiry'
do
user
.
password_expires_at
=
Time
.
now
+
20010101
user
.
ldap_user?
.
should
be_false
controller
.
stub!
(
:current_user
).
and_return
(
user
)
controller
.
should_not_receive
(
:redirect_to
)
controller
.
send
(
:check_password_expiration
)
end
it
'should not redirect if the user is over their password expiry but they are an ldap user'
do
user
.
password_expires_at
=
Time
.
new
(
2002
)
user
.
stub!
(
:ldap_user?
).
and_return
(
true
)
controller
.
stub!
(
:current_user
).
and_return
(
user
)
controller
.
should_not_receive
(
:redirect_to
)
controller
.
send
(
:check_password_expiration
)
end
end
end
\ No newline at end of file
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