Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
projects.thm.de
GitLab
Commits
27658fdf
Commit
27658fdf
authored
Apr 14, 2015
by
Daniel Gerhardt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Forbid password changing for CAS users
parent
7731eea9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletion
+9
-1
app/controllers/passwords_controller.rb
app/controllers/passwords_controller.rb
+8
-0
app/views/layouts/nav/sidebar/_profile.html.haml
app/views/layouts/nav/sidebar/_profile.html.haml
+1
-1
No files found.
app/controllers/passwords_controller.rb
View file @
27658fdf
...
...
@@ -5,6 +5,7 @@ class PasswordsController < Devise::PasswordsController
before_action
:resource_from_email
,
only:
[
:create
]
before_action
:check_password_authentication_available
,
only:
[
:create
]
before_action
:prevent_cas_reset
,
only:
[
:create
]
before_action
:throttle_reset
,
only:
[
:create
]
# rubocop: disable CodeReuse/ActiveRecord
...
...
@@ -55,6 +56,13 @@ def check_password_authentication_available
alert:
"Password authentication is unavailable."
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/views/layouts/nav/sidebar/_profile.html.haml
View file @
27658fdf
...
...
@@ -72,7 +72,7 @@
=
link_to
profile_emails_path
do
%strong
.fly-out-top-item-name
=
_
(
'Emails'
)
-
if
current_user
.
allow_password_authentication?
-
if
current_user
.
allow_password_authentication?
&&
!
current_user
.
cas_user?
=
nav_link
(
controller: :passwords
)
do
=
link_to
edit_profile_password_path
do
.nav-icon-container
...
...
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