Commit 3832b2aa authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Improve Profile#account page

parent 3707cc11
...@@ -4,4 +4,16 @@ module ProfileHelper ...@@ -4,4 +4,16 @@ module ProfileHelper
'active' 'active'
end end
end end
def show_profile_username_tab?
current_user.can_change_username?
end
def show_profile_social_tab?
Gitlab.config.omniauth.enabled && !current_user.ldap_user?
end
def show_profile_remove_tab?
Gitlab.config.gitlab.signup_enabled && !current_user.ldap_user?
end
end end
...@@ -5,91 +5,128 @@ ...@@ -5,91 +5,128 @@
- if current_user.ldap_user? - if current_user.ldap_user?
Some options are unavailable for LDAP accounts Some options are unavailable for LDAP accounts
%hr %hr
- unless current_user.ldap_user?
- if Gitlab.config.omniauth.enabled
%fieldset
%legend Social Accounts
.oauth_select_holder
%p.hint Tip: Click on icon to activate signin with one of the following services
- enabled_social_providers.each do |provider|
%span{class: oauth_active_class(provider) }
= link_to authbutton(provider, 32), omniauth_authorize_path(User, provider)
%fieldset.update-password .row
%legend Password .span2
= form_for @user, url: update_password_profile_path, method: :put do |f| %ul.nav.nav-pills.nav-stacked.nav-stacked-menu
.padded %li.active
%p.slead After a successful password update you will be redirected to login page where you should login with your new password = link_to '#tab-token', 'data-toggle' => 'tab' do
-if @user.errors.any? Private Token
.alert.alert-error %li
%ul = link_to '#tab-password', 'data-toggle' => 'tab' do
- @user.errors.full_messages.each do |msg| Password
%li= msg
.control-group - if show_profile_social_tab?
= f.label :password %li
.controls= f.password_field :password, required: true = link_to '#tab-social', 'data-toggle' => 'tab' do
.control-group Social Accounts
= f.label :password_confirmation
.controls
= f.password_field :password_confirmation, required: true
.control-group
.controls
= f.submit 'Save password', class: "btn btn-save"
- if show_profile_username_tab?
%li
= link_to '#tab-username', 'data-toggle' => 'tab' do
Change Username
- if show_profile_remove_tab?
%li
= link_to '#tab-remove', 'data-toggle' => 'tab' do
Remove Account
.span10
.tab-content
.tab-pane.active#tab-token
%fieldset.update-token
%legend
Private token
%span.cred.pull-right
keep it secret!
%div
= form_for @user, url: reset_private_token_profile_path, method: :put do |f|
.data
%p.slead
Your private token is used to access application resources without authentication.
%br
It can be used for atom feeds or the API.
%p.cgray
- if current_user.private_token
= text_field_tag "token", current_user.private_token, class: "input-xxlarge large_text input-xpadding"
= f.submit 'Reset', confirm: "Are you sure?", class: "btn btn-primary btn-build-token"
- else
%span You don`t have one yet. Click generate to fix it.
= f.submit 'Generate', class: "btn success btn-build-token"
%fieldset.update-token .tab-pane#tab-password
%legend %fieldset.update-password
Private token %legend Password
%span.cred.pull-right = form_for @user, url: update_password_profile_path, method: :put do |f|
keep it secret! %div
.padded %p.slead After a successful password update you will be redirected to login page where you should login with your new password
= form_for @user, url: reset_private_token_profile_path, method: :put do |f| -if @user.errors.any?
.data .alert.alert-error
%p.slead %ul
Your private token is used to access application resources without authentication. - @user.errors.full_messages.each do |msg|
%br %li= msg
It can be used for atom feeds or the API. .control-group
%p.cgray = f.label :password
- if current_user.private_token .controls= f.password_field :password, required: true
= text_field_tag "token", current_user.private_token, class: "input-xxlarge large_text input-xpadding" .control-group
= f.submit 'Reset', confirm: "Are you sure?", class: "btn btn-primary btn-build-token" = f.label :password_confirmation
- else .controls
%span You don`t have one yet. Click generate to fix it. = f.password_field :password_confirmation, required: true
= f.submit 'Generate', class: "btn success btn-build-token" .control-group
.controls
= f.submit 'Save password', class: "btn btn-save"
- if show_profile_social_tab?
.tab-pane#tab-social
%fieldset
%legend Social Accounts
.oauth_select_holder
%p.hint Tip: Click on icon to activate signin with one of the following services
- enabled_social_providers.each do |provider|
%span{class: oauth_active_class(provider) }
= link_to authbutton(provider, 32), omniauth_authorize_path(User, provider)
- if current_user.can_change_username? - if show_profile_username_tab?
%fieldset.update-username .tab-pane#tab-username
%legend %fieldset.update-username
Username %legend
%small.cred.pull-right Username
Changing your username can have unintended side effects! %small.cred.pull-right
= form_for @user, url: update_username_profile_path, method: :put, remote: true do |f| Changing your username can have unintended side effects!
.padded = form_for @user, url: update_username_profile_path, method: :put, remote: true do |f|
= f.label :username %div
.controls .control-group
= f.text_field :username, required: true = f.label :username
  .controls
%span.loading-gif.hide= image_tag "ajax_loader.gif" = f.text_field :username, required: true
%span.update-success.cgreen.hide  
%i.icon-ok %span.loading-gif.hide= image_tag "ajax_loader.gif"
Saved %span.update-success.cgreen.hide
%span.update-failed.cred.hide %i.icon-ok
%i.icon-remove Saved
Failed %span.update-failed.cred.hide
%ul.cred %i.icon-remove
%li This will change the web URL for personal projects. Failed
%li This will change the git path to repositories for personal projects. %ul.cred
.controls %li This will change the web URL for personal projects.
= f.submit 'Save username', class: "btn btn-save" %li This will change the git path to repositories for personal projects.
.controls
= f.submit 'Save username', class: "btn btn-save"
- if gitlab_config.signup_enabled && !current_user.ldap_user? - if show_profile_remove_tab?
%fieldset.remove-account .tab-pane#tab-remove
%legend %fieldset.remove-account
Remove account %legend
%small.cred.pull-right Remove account
Before removing the account you must remove all projects! %div
= link_to 'Delete account', user_registration_path, confirm: "REMOVE #{current_user.name}? Are you sure?", method: :delete, class: "btn btn-remove delete-key btn-small pull-right" %p Deleting an account has the following effects:
%ul
%li All user content like authored issues, snippets, comments will be removed
- rp = current_user.personal_projects.count
- unless rp.zero?
%li #{pluralize rp, 'personal project'} will be removed and cannot be restored
- if current_user.solo_owned_groups.present?
%li
Next groups will be abandoned. You should transfer or remove them:
%strong #{current_user.solo_owned_groups.map(&:name).join(', ')}
= link_to 'Delete account', user_registration_path, confirm: "REMOVE #{current_user.name}? Are you sure?", method: :delete, class: "btn btn-remove"
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