Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
GitLab
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
projects.thm.de
GitLab
Commits
2ec5db6b
Commit
2ec5db6b
authored
Apr 14, 2015
by
Daniel Gerhardt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Forbid password changing for CAS users
parent
411d5e22
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
2 deletions
+10
-2
app/controllers/passwords_controller.rb
app/controllers/passwords_controller.rb
+8
-0
app/controllers/profiles/passwords_controller.rb
app/controllers/profiles/passwords_controller.rb
+1
-1
app/views/layouts/nav/_profile.html.haml
app/views/layouts/nav/_profile.html.haml
+1
-1
No files found.
app/controllers/passwords_controller.rb
View file @
2ec5db6b
class
PasswordsController
<
Devise
::
PasswordsController
before_action
:resource_from_email
,
only:
[
:create
]
before_action
:prevent_ldap_reset
,
only:
[
:create
]
before_action
:prevent_cas_reset
,
only:
[
:create
]
before_action
:throttle_reset
,
only:
[
:create
]
def
edit
...
...
@@ -45,6 +46,13 @@ def prevent_ldap_reset
alert:
"Cannot reset password for LDAP user."
end
def
prevent_cas_reset
return
unless
resource
&&
resource
.
cas_user?
redirect_to
after_sending_reset_password_instructions_path_for
(
resource_name
),
alert:
"Cannot reset password for CAS user."
end
def
throttle_reset
return
unless
resource
&&
resource
.
recently_sent_password_reset?
...
...
app/controllers/profiles/passwords_controller.rb
View file @
2ec5db6b
...
...
@@ -75,7 +75,7 @@ def determine_layout
end
def
authorize_change_password!
return
render_404
if
@user
.
ldap_user?
return
render_404
if
@user
.
ldap_user?
||
@user
.
cas_user?
end
def
user_params
...
...
app/views/layouts/nav/_profile.html.haml
View file @
2ec5db6b
...
...
@@ -29,7 +29,7 @@
=
link_to
profile_emails_path
,
title:
'Emails'
do
%span
Emails
-
unless
current_user
.
ldap_user?
-
unless
current_user
.
ldap_user?
||
current_user
.
cas_user?
=
nav_link
(
controller: :passwords
)
do
=
link_to
edit_profile_password_path
,
title:
'Password'
do
%span
...
...
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