Commit cec88d81 authored by Jacob Schatz's avatar Jacob Schatz

Merge branch 'account-settings' into 'master'

Account settings

Closes #13854

![](https://gitlab.com/gitlab-org/gitlab-ce/uploads/4802a7b4f74f17d25a611ed1a2200445/account-settings.png)

See merge request !3039
parents d343c7a1 c9b62662
...@@ -41,6 +41,7 @@ v 8.5.3 ...@@ -41,6 +41,7 @@ v 8.5.3
- Sort starred projects on dashboard based on last activity by default - Sort starred projects on dashboard based on last activity by default
- Show commit message in JIRA mention comment - Show commit message in JIRA mention comment
- Makes issue page and merge request page usable on mobile browsers. - Makes issue page and merge request page usable on mobile browsers.
- Improved UI for profile settings
v 8.5.2 v 8.5.2
- Fix sidebar overlapping content when screen width was below 1200px - Fix sidebar overlapping content when screen width was below 1200px
......
...@@ -4,12 +4,13 @@ class @Profile ...@@ -4,12 +4,13 @@ class @Profile
$('.js-preferences-form').on 'change.preference', 'input[type=radio]', -> $('.js-preferences-form').on 'change.preference', 'input[type=radio]', ->
$(this).parents('form').submit() $(this).parents('form').submit()
$('.update-username form').on 'ajax:before', -> $('.update-username').on 'ajax:before', ->
$('.loading-gif').show() $('.loading-username').show()
$(this).find('.update-success').hide() $(this).find('.update-success').hide()
$(this).find('.update-failed').hide() $(this).find('.update-failed').hide()
$('.update-username form').on 'ajax:complete', -> $('.update-username').on 'ajax:complete', ->
$('.loading-username').hide()
$(this).find('.btn-save').enable() $(this).find('.btn-save').enable()
$(this).find('.loading-gif').hide() $(this).find('.loading-gif').hide()
......
...@@ -12,11 +12,13 @@ ...@@ -12,11 +12,13 @@
.prepend-top-default { margin-top: $gl-padding !important; } .prepend-top-default { margin-top: $gl-padding !important; }
.prepend-top-20 { margin-top:20px } .prepend-top-20 { margin-top:20px }
.prepend-left-10 { margin-left:10px } .prepend-left-10 { margin-left:10px }
.prepend-left-default { margin-left:$gl-padding } .prepend-left-default { margin-left: $gl-padding; }
.prepend-left-20 { margin-left:20px } .prepend-left-20 { margin-left:20px }
.append-right-5 { margin-right: 5px } .append-right-5 { margin-right: 5px }
.append-right-10 { margin-right:10px } .append-right-10 { margin-right:10px }
.append-right-default { margin-right: $gl-padding; }
.append-right-20 { margin-right:20px } .append-right-20 { margin-right:20px }
.append-bottom-0 { margin-bottom:0 }
.append-bottom-10 { margin-bottom:10px } .append-bottom-10 { margin-bottom:10px }
.append-bottom-15 { margin-bottom:15px } .append-bottom-15 { margin-bottom:15px }
.append-bottom-20 { margin-bottom:20px } .append-bottom-20 { margin-bottom:20px }
......
...@@ -34,13 +34,15 @@ $error-exclamation-point: #E62958; ...@@ -34,13 +34,15 @@ $error-exclamation-point: #E62958;
$border-radius-default: 3px; $border-radius-default: 3px;
$list-title-color: #333333; $list-title-color: #333333;
$list-text-color: #555555; $list-text-color: #555555;
$profile-settings-link-color: $md-link-color;
$btn-transparent-color: #8F8F8F; $btn-transparent-color: #8F8F8F;
$ssh-key-icon-color: #8F8F8F; $ssh-key-icon-color: #8F8F8F;
$ssh-key-icon-size: 18px; $ssh-key-icon-size: 18px;
$provider-btn-group-border: #E5E5E5;
$provider-btn-not-active-color: #4688F1;
/* /*
* Color schema * Color schema
*/ */
...@@ -70,7 +72,7 @@ $orange-light: rgba(252, 109, 38, 0.80); ...@@ -70,7 +72,7 @@ $orange-light: rgba(252, 109, 38, 0.80);
$orange-normal: #E75E40; $orange-normal: #E75E40;
$orange-dark: #CE5237; $orange-dark: #CE5237;
$red-light: #F43263; $red-light: #F06559;
$red-normal: #E52C5A; $red-normal: #E52C5A;
$red-dark: #D22852; $red-dark: #D22852;
...@@ -94,7 +96,7 @@ $border-orange-light: #fc6d26; ...@@ -94,7 +96,7 @@ $border-orange-light: #fc6d26;
$border-orange-normal: #CE5237; $border-orange-normal: #CE5237;
$border-orange-dark: #C14E35; $border-orange-dark: #C14E35;
$border-red-light: #E52C5A; $border-red-light: #F24F41;
$border-red-normal: #D22852; $border-red-normal: #D22852;
$border-red-dark: #CA264F; $border-red-dark: #CA264F;
......
.account-page { .profile-avatar-form-option {
fieldset { hr {
margin-bottom: 15px; margin: 10px 0;
padding-bottom: 15px;
} }
} }
...@@ -20,7 +19,7 @@ ...@@ -20,7 +19,7 @@
.account-btn-link, .account-btn-link,
.profile-settings-sidebar a { .profile-settings-sidebar a {
color: $profile-settings-link-color; color: $md-link-color;
} }
.oauth-buttons { .oauth-buttons {
...@@ -172,6 +171,47 @@ ...@@ -172,6 +171,47 @@
.profile-settings-content { .profile-settings-content {
a { a {
color: $profile-settings-link-color; color: $md-link-color;
}
}
.change-username-title {
color: $gl-warning;
}
.remove-account-title {
color: $gl-danger;
}
.provider-btn-group {
display: inline-block;
margin-right: 10px;
border: 1px solid $provider-btn-group-border;
border-radius: 3px;
&:last-child {
margin-right: 0;
}
}
.provider-btn-image {
display: inline-block;
padding: 5px 10px;
border-right: 1px solid $provider-btn-group-border;
> img {
width: 20px;
}
}
.provider-btn {
display: inline-block;
padding: 5px 10px;
margin-left: -3px;
line-height: 22px;
background-color: $gray-light;
&.not-active {
color: $provider-btn-not-active-color;
} }
} }
...@@ -5,114 +5,113 @@ ...@@ -5,114 +5,113 @@
.alert.alert-info .alert.alert-info
Some options are unavailable for LDAP accounts Some options are unavailable for LDAP accounts
.account-page.prepend-top-default .row.prepend-top-default
.panel.panel-default.update-token .col-lg-3.profile-settings-sidebar
.panel-heading %h4.prepend-top-0
Reset Private token Private Token
.panel-body %p
= form_for @user, url: reset_private_token_profile_path, method: :put do |f| Your private token is used to access application resources without authentication.
.data .col-lg-9
%p = form_for @user, url: reset_private_token_profile_path, method: :put, html: {class: "private-token"} do |f|
Your private token is used to access application resources without authentication. %p.cgray
%br - if current_user.private_token
It can be used for atom feeds or the API. = label_tag "token", "Private token", class: "label-light"
%span.cred = text_field_tag "token", current_user.private_token, class: "form-control"
Keep it secret! - else
%span You don`t have one yet. Click generate to fix it.
%p.cgray %p.help-block
- if current_user.private_token It can be used for atom feeds or the API. Keep it secret!
= text_field_tag "token", current_user.private_token, class: "form-control" .prepend-top-default
- else - if current_user.private_token
%span You don`t have one yet. Click generate to fix it. = f.submit 'Reset private token', data: { confirm: "Are you sure?" }, class: "btn btn-default"
- else
.form-actions = f.submit 'Generate', class: "btn btn-default"
- if current_user.private_token %hr
= f.submit 'Reset private token', data: { confirm: "Are you sure?" }, class: "btn btn-default" .row.prepend-top-default
- else .col-lg-3.profile-settings-sidebar
= f.submit 'Generate', class: "btn btn-default" %h4.prepend-top-0
.panel.panel-default
.panel-heading
Two-factor Authentication Two-factor Authentication
.panel-body %p
- if current_user.two_factor_enabled? Increase your account's security by enabling two-factor authentication (2FA).
.pull-right .col-lg-9
= link_to 'Disable Two-factor Authentication', profile_two_factor_auth_path, method: :delete, class: 'btn btn-close btn-sm', %p
Status: #{current_user.two_factor_enabled? ? 'enabled' : 'disabled'}
- if !current_user.two_factor_enabled?
%p
Download the Google Authenticator application from App Store for iOS or Google Play for Android and scan this code.
More information is available in the #{link_to('documentation', help_page_path('profile', 'two_factor_authentication'))}.
.append-bottom-10
= link_to 'Enable two-factor authentication', new_profile_two_factor_auth_path, class: 'btn btn-success'
- else
= link_to 'Disable Two-factor Authentication', profile_two_factor_auth_path, method: :delete, class: 'btn btn-danger',
data: { confirm: 'Are you sure?' } data: { confirm: 'Are you sure?' }
%p.text-success %hr
%strong - if button_based_providers.any?
Two-factor Authentication is enabled .row.prepend-top-default
%p .col-lg-3.profile-settings-sidebar
If you lose your recovery codes you can %h4.prepend-top-0
%strong Social sign-in
= succeed ',' do %p
= link_to 'generate new ones', codes_profile_two_factor_auth_path, method: :post, data: { confirm: 'Are you sure?' } Activate signin with one of the following services
invalidating all previous codes. .col-lg-9
%label.label-light
- else
%p
Increase your account's security by enabling two-factor authentication (2FA).
%p
Each time you log in you’ll be required to provide your username and
password as usual, plus a randomly-generated code from your phone.
.form-actions
= link_to 'Enable Two-factor Authentication', new_profile_two_factor_auth_path, class: 'btn btn-success'
- if button_based_providers.any?
.panel.panel-default
.panel-heading
Connected Accounts Connected Accounts
.panel-body %p Click on icon to activate signin with one of the following services
.oauth-buttons.append-bottom-10 - button_based_providers.each do |provider|
%p Click on icon to activate signin with one of the following services .provider-btn-group
- button_based_providers.each do |provider| .provider-btn-image
.btn-group = provider_image_tag(provider)
= link_to provider_image_tag(provider), user_omniauth_authorize_path(provider), method: :post, class: "btn btn-lg #{'active' if auth_active?(provider)}", "data-no-turbolink" => "true" - if auth_active?(provider)
= link_to unlink_profile_account_path(provider: provider), method: :delete, class: 'provider-btn' do
- if auth_active?(provider) Disconnect
= link_to unlink_profile_account_path(provider: provider), method: :delete, class: 'btn btn-lg' do - else
= icon('close') = link_to user_omniauth_authorize_path(provider), method: :post, class: "provider-btn #{'not-active' if !auth_active?(provider)}", "data-no-turbolink" => "true" do
Connect
- if current_user.can_change_username? %hr
.panel.panel-warning.update-username - if current_user.can_change_username?
.panel-heading .row.prepend-top-default
Change Username .col-lg-3.profile-settings-sidebar
.panel-body %h4.prepend-top-0.change-username-title
= form_for @user, url: update_username_profile_path, method: :put, remote: true do |f| Change username
%p %p
Changing your username will change path to all personal projects! Changing your username will change path to all personal projects!
%div .col-lg-9
.input-group = form_for @user, url: update_username_profile_path, method: :put, remote: true, html: {class: "update-username"} do |f|
.input-group-addon .form-group
= "#{root_url}u/" = f.label :username, "Path", class: "label-light"
= f.text_field :username, required: true, class: 'form-control' .input-group
  .input-group-addon
.loading-gif.hide = "#{root_url}u/"
%p = f.text_field :username, required: true, class: 'form-control'
= icon('spinner spin') .help-block
Saving new username Current path:
.form-actions = "#{root_url}u/#{current_user.username}"
= f.submit 'Save username', class: "btn btn-warning" .prepend-top-default
= f.button class: "btn btn-warning", type: "submit" do
= icon "spinner spin", class: "hidden loading-username"
Update username
%hr
- if signup_enabled? - if signup_enabled?
.panel.panel-danger.remove-account .row.prepend-top-default
.panel-heading .col-lg-3.profile-settings-sidebar
%h4.prepend-top-0.remove-account-title
Remove account Remove account
.panel-body .col-lg-9
- if @user.can_be_removed? - if @user.can_be_removed?
%p Deleting an account has the following effects: %p
%ul Deleting an account has the following effects:
%li All user content like authored issues, snippets, comments will be removed %ul
- rp = current_user.personal_projects.count %li All user content like authored issues, snippets, comments will be removed
- unless rp.zero? - rp = current_user.personal_projects.count
%li #{pluralize rp, 'personal project'} will be removed and cannot be restored - unless rp.zero?
.form-actions %li #{pluralize rp, 'personal project'} will be removed and cannot be restored
= link_to 'Delete account', user_registration_path, data: { confirm: "REMOVE #{current_user.name}? Are you sure?" }, method: :delete, class: "btn btn-remove" = link_to 'Delete account', user_registration_path, data: { confirm: "REMOVE #{current_user.name}? Are you sure?" }, method: :delete, class: "btn btn-remove"
- else - else
- if @user.solo_owned_groups.present? - if @user.solo_owned_groups.present?
%p %p
Your account is currently an owner in these groups: Your account is currently an owner in these groups:
%strong #{@user.solo_owned_groups.map(&:name).join(', ')} %strong #{@user.solo_owned_groups.map(&:name).join(', ')}
%p %p
You must transfer ownership or delete these groups before you can delete your account. You must transfer ownership or delete these groups before you can delete your account.
.append-bottom-default
- page_title 'Two-factor Authentication', 'Account' - page_title 'Two-factor Authentication', 'Account'
%h2.page-title Two-factor Authentication (2FA) .row.prepend-top-default
%p .col-lg-3
Download the Google Authenticator application from App Store for iOS or Google %h4.prepend-top-0
Play for Android and scan this code. Two-factor Authentication (2FA)
%p
More information is available in the #{link_to('documentation', help_page_path('profile', 'two_factor_authentication'))}. Increase your account's security by enabling two-factor authentication (2FA).
.col-lg-9
%hr %p
Status: #{current_user.two_factor_enabled? ? 'enabled' : 'disabled'}
= form_tag profile_two_factor_auth_path, method: :post, class: 'form-horizontal two-factor-new' do |f| %p
- if @error Download the Google Authenticator application from App Store for iOS or Google Play for Android and scan this code.
.alert.alert-danger More information is available in the #{link_to('documentation', help_page_path('profile', 'two_factor_authentication'))}.
= @error .row.append-bottom-10
.form-group .col-md-3
.col-lg-2.col-lg-offset-2 = raw @qr_code
= raw @qr_code .col-md-9
.col-lg-7.col-lg-offset-1.manual-instructions .account-well
%h3 Can't scan the code? %p.prepend-top-0.append-bottom-0
Can't scan the code?
%p %p.prepend-top-0.append-bottom-0
To add the entry manually, provide the following details to the To add the entry manually, provide the following details to the application on your phone.
application on your phone. %p.prepend-top-0.append-bottom-0
Account:
%dl = current_user.email
%dt Account %p.prepend-top-0.append-bottom-0
%dd= current_user.email Key:
%dl = current_user.otp_secret.scan(/.{4}/).join(' ')
%dt Key %p.two-factor-new-manual-content
%dd= current_user.otp_secret.scan(/.{4}/).join(' ') Time based: Yes
%dl = form_tag profile_two_factor_auth_path, method: :post do |f|
%dt Time based - if @error
%dd Yes .alert.alert-danger
.form-group = @error
= label_tag :pin_code, nil, class: "control-label" .form-group
.col-lg-10 = label_tag :pin_code, nil, class: "label-light"
= text_field_tag :pin_code, nil, class: "form-control", required: true, autofocus: true = text_field_tag :pin_code, nil, class: "form-control", required: true
.form-actions .prepend-top-default
= submit_tag 'Submit', class: 'btn btn-success' = submit_tag 'Enable two-factor authentication', class: 'btn btn-success'
= link_to 'Configure it later', skip_profile_two_factor_auth_path, :method => :patch, class: 'btn btn-cancel' if two_factor_skippable? = link_to 'Configure it later', skip_profile_two_factor_auth_path, :method => :patch, class: 'btn btn-cancel' if two_factor_skippable?
...@@ -99,9 +99,9 @@ class Spinach::Features::Profile < Spinach::FeatureSteps ...@@ -99,9 +99,9 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
end end
step 'I reset my token' do step 'I reset my token' do
page.within '.update-token' do page.within '.private-token' do
@old_token = @user.private_token @old_token = @user.private_token
click_button "Reset" click_button "Reset private token"
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment