diff options
author | Robin Bobbitt <ryehle@us.ibm.com> | 2017-06-06 11:39:54 -0400 |
---|---|---|
committer | Robin Bobbitt <ryehle@us.ibm.com> | 2017-06-07 11:13:57 -0400 |
commit | 469acd190e497cda8516da0ee481f33e038d7e9e (patch) | |
tree | 7b2fd577757c49570fc353a02a23533a0674d8fa /app | |
parent | 8fdba5fac2a5fb4ce17a11580e94a85257e76e2c (diff) | |
download | gitlab-ce-469acd190e497cda8516da0ee481f33e038d7e9e.tar.gz |
Sync email address from specified omniauth provider
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/profiles_controller.rb | 4 | ||||
-rw-r--r-- | app/helpers/profiles_helper.rb | 7 | ||||
-rw-r--r-- | app/views/profiles/show.html.haml | 4 |
3 files changed, 11 insertions, 4 deletions
diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb index 8cd1c47eb3f..72f34930ca8 100644 --- a/app/controllers/profiles_controller.rb +++ b/app/controllers/profiles_controller.rb @@ -9,7 +9,7 @@ class ProfilesController < Profiles::ApplicationController end def update - user_params.except!(:email) if @user.ldap_user? + user_params.except!(:email) if @user.external_email? respond_to do |format| if @user.update_attributes(user_params) @@ -76,7 +76,7 @@ class ProfilesController < Profiles::ApplicationController end def user_params - params.require(:user).permit( + @user_params ||= params.require(:user).permit( :avatar, :bio, :email, diff --git a/app/helpers/profiles_helper.rb b/app/helpers/profiles_helper.rb new file mode 100644 index 00000000000..45238f12ac7 --- /dev/null +++ b/app/helpers/profiles_helper.rb @@ -0,0 +1,7 @@ +module ProfilesHelper + def email_provider_label + return unless current_user.external_email? + + current_user.email_provider.present? ? Gitlab::OAuth::Provider.label_for(current_user.email_provider) : "LDAP" + end +end diff --git a/app/views/profiles/show.html.haml b/app/views/profiles/show.html.haml index 4a1438aa68e..fcfd350f0da 100644 --- a/app/views/profiles/show.html.haml +++ b/app/views/profiles/show.html.haml @@ -49,10 +49,10 @@ .form-group = f.label :email, class: "label-light" - - if @user.ldap_user? && @user.ldap_email? + - if @user.external_email? = f.text_field :email, class: "form-control", required: true, readonly: true %span.help-block.light - Your email address was automatically set based on the LDAP server. + Your email address was automatically set based on your #{email_provider_label} account. - else - if @user.temp_oauth_email? = f.text_field :email, class: "form-control", required: true, value: nil |