diff options
author | Marin Jankovski <marin@gitlab.com> | 2014-03-18 15:25:49 +0400 |
---|---|---|
committer | Marin Jankovski <marin@gitlab.com> | 2014-03-18 15:25:49 +0400 |
commit | a740e2d6d16271c2e3d06252e35e65b10d002834 (patch) | |
tree | f60f9ca5d58516012ce8d417de19daf1a38a1132 /app/controllers/passwords_controller.rb | |
parent | 8fa53ce43dff48a3e282460c9f9f40dbdfee6e12 (diff) |
Do not allow password reset for ldap user.
Diffstat (limited to 'app/controllers/passwords_controller.rb')
-rw-r--r-- | app/controllers/passwords_controller.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/app/controllers/passwords_controller.rb b/app/controllers/passwords_controller.rb new file mode 100644 index 00000000000..988ede3007b --- /dev/null +++ b/app/controllers/passwords_controller.rb @@ -0,0 +1,18 @@ +class PasswordsController < Devise::PasswordsController + + def create + email = resource_params[:email] + resource_found = resource_class.find_by_email(email) + if resource_found && resource_found.ldap_user? + flash[:alert] = "Cannot reset password for LDAP user." + respond_with({}, :location => after_sending_reset_password_instructions_path_for(resource_name)) and return + end + + self.resource = resource_class.send_reset_password_instructions(resource_params) + if successfully_sent?(resource) + respond_with({}, :location => after_sending_reset_password_instructions_path_for(resource_name)) + else + respond_with(resource) + end + end +end |