diff options
| author | Douwe Maan <douwe@gitlab.com> | 2015-02-13 13:33:28 +0100 |
|---|---|---|
| committer | Douwe Maan <douwe@gitlab.com> | 2015-02-13 14:44:42 +0100 |
| commit | 25e44d05300a6b5b35232b27b4ccb27f47f09a67 (patch) | |
| tree | f46c5753255cae37b492a988ffffd9d1dd4d1f6d /app/controllers/profiles | |
| parent | 529188e4788991961796b1b6131389072ee61efb (diff) | |
| download | gitlab-ce-25e44d05300a6b5b35232b27b4ccb27f47f09a67.tar.gz | |
Allow users that signed up via OAuth to set their password in order to use Git over HTTP(S).
Diffstat (limited to 'app/controllers/profiles')
| -rw-r--r-- | app/controllers/profiles/passwords_controller.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/app/controllers/profiles/passwords_controller.rb b/app/controllers/profiles/passwords_controller.rb index 1191ce47eba..0c614969a3f 100644 --- a/app/controllers/profiles/passwords_controller.rb +++ b/app/controllers/profiles/passwords_controller.rb @@ -11,7 +11,7 @@ class Profiles::PasswordsController < ApplicationController end def create - unless @user.valid_password?(user_params[:current_password]) + unless @user.password_automatically_set || @user.valid_password?(user_params[:current_password]) redirect_to new_profile_password_path, alert: 'You must provide a valid current password' return end @@ -21,7 +21,8 @@ class Profiles::PasswordsController < ApplicationController result = @user.update_attributes( password: new_password, - password_confirmation: new_password_confirmation + password_confirmation: new_password_confirmation, + password_automatically_set: false ) if result @@ -39,8 +40,9 @@ class Profiles::PasswordsController < ApplicationController password_attributes = user_params.select do |key, value| %w(password password_confirmation).include?(key.to_s) end + password_attributes[:password_automatically_set] = false - unless @user.valid_password?(user_params[:current_password]) + unless @user.password_automatically_set || @user.valid_password?(user_params[:current_password]) redirect_to edit_profile_password_path, alert: 'You must provide a valid current password' return end |
