diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-06-23 12:09:45 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-06-23 12:09:45 +0200 |
commit | 8c6cbd430639f03461df625ff1cbeca1294f4b25 (patch) | |
tree | efab5b4324c6166141e42eaaa04de3087e356b8d /app | |
parent | 7780a886e7c90b2fbe281d3b8452151c20659543 (diff) | |
parent | 4b31f4b68319a9099a36d6e59f153a1ae0a50f1d (diff) | |
download | gitlab-ce-admin-edit-identities.tar.gz |
Merge branch 'master' into admin-edit-identitiesadmin-edit-identities
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/stylesheets/generic/header.scss | 28 | ||||
-rw-r--r-- | app/assets/stylesheets/generic/sidebar.scss | 22 | ||||
-rw-r--r-- | app/models/user.rb | 34 | ||||
-rw-r--r-- | app/views/admin/users/index.html.haml | 8 | ||||
-rw-r--r-- | app/views/layouts/header/_default.html.haml | 3 | ||||
-rw-r--r-- | app/views/layouts/header/_public.html.haml | 3 |
6 files changed, 62 insertions, 36 deletions
diff --git a/app/assets/stylesheets/generic/header.scss b/app/assets/stylesheets/generic/header.scss index 26eb7ab1a12..8faae893a51 100644 --- a/app/assets/stylesheets/generic/header.scss +++ b/app/assets/stylesheets/generic/header.scss @@ -3,6 +3,8 @@ * */ header { + transition-duration: .3s; + &.navbar-empty { background: #FFF; border-bottom: 1px solid #EEE; @@ -67,28 +69,34 @@ header { float: left; height: $header-height; width: $sidebar_width; + transition-duration: .3s; a { float: left; height: $header-height; width: 100%; padding: ($header-height - 36 ) / 2 8px; - - h3 { - width: 158px; - float: left; - margin: 0; - margin-left: 14px; - font-size: 18px; - line-height: $header-height - 14; - font-weight: normal; - } + overflow: hidden; img { width: 36px; height: 36px; float: left; } + + .gitlab-text-container { + width: 230px; + + h3 { + width: 158px; + float: left; + margin: 0; + margin-left: 14px; + font-size: 18px; + line-height: $header-height - 14; + font-weight: normal; + } + } } &:hover { diff --git a/app/assets/stylesheets/generic/sidebar.scss b/app/assets/stylesheets/generic/sidebar.scss index 65e06e14c73..add0d1b04ad 100644 --- a/app/assets/stylesheets/generic/sidebar.scss +++ b/app/assets/stylesheets/generic/sidebar.scss @@ -4,12 +4,14 @@ top: 0; left: 0; height: 100%; + transition-duration: .3s; } } .sidebar-wrapper { z-index: 99; background: $background-color; + transition-duration: .3s; } .content-wrapper { @@ -19,8 +21,10 @@ } .nav-sidebar { + transition-duration: .3s; margin: 0; list-style: none; + overflow: hidden; &.navbar-collapse { padding: 0px !important; @@ -35,9 +39,6 @@ } .nav-sidebar li { -} - -.nav-sidebar li { &.separate-item { padding-top: 10px; margin-top: 10px; @@ -48,7 +49,7 @@ display: block; text-decoration: none; padding: 8px 15px; - font-size: 13px; + font-size: 14px; line-height: 20px; padding-left: 16px; @@ -79,6 +80,7 @@ @mixin expanded-sidebar { padding-left: $sidebar_width; + transition-duration: .3s; .sidebar-wrapper { width: $sidebar_width; @@ -89,6 +91,10 @@ top: $header-height; width: $sidebar_width; } + + .nav-sidebar li a{ + width: 230px; + } } .content-wrapper { @@ -98,6 +104,7 @@ @mixin folded-sidebar { padding-left: 50px; + transition-duration: .3s; .sidebar-wrapper { width: $sidebar_collapsed_width; @@ -109,10 +116,10 @@ width: $sidebar_collapsed_width; li a { - padding-left: 18px; font-size: 14px; padding: 8px 15px; - text-align: center; + text-align: left; + padding-left: 16px; & > span { @@ -144,6 +151,7 @@ height: 28px; text-align: center; line-height: 28px; + transition-duration: .3s; } .collapse-nav a:hover { @@ -180,8 +188,10 @@ bottom: 0; width: 100%; padding: 10px; + overflow: hidden; .username { margin-top: 5px; + width: 230px; } } diff --git a/app/models/user.rb b/app/models/user.rb index 29f43051464..22cd15bf971 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -50,12 +50,12 @@ # bitbucket_access_token :string(255) # bitbucket_access_token_secret :string(255) # location :string(255) -# public_email :string(255) default(""), not null # encrypted_otp_secret :string(255) # encrypted_otp_secret_iv :string(255) # encrypted_otp_secret_salt :string(255) -# otp_required_for_login :boolean +# otp_required_for_login :boolean default(FALSE), not null # otp_backup_codes :text +# public_email :string(255) default(""), not null # dashboard :integer default(0) # @@ -80,6 +80,7 @@ class User < ActiveRecord::Base devise :two_factor_authenticatable, otp_secret_encryption_key: File.read(Rails.root.join('.secret')).chomp + alias_attribute :two_factor_enabled, :otp_required_for_login devise :two_factor_backupable, otp_number_of_backup_codes: 10 serialize :otp_backup_codes, JSON @@ -193,11 +194,13 @@ class User < ActiveRecord::Base mount_uploader :avatar, AvatarUploader # Scopes - scope :admins, -> { where(admin: true) } + scope :admins, -> { where(admin: true) } scope :blocked, -> { with_state(:blocked) } scope :active, -> { with_state(:active) } scope :not_in_project, ->(project) { project.users.present? ? where("id not in (:ids)", ids: project.users.map(&:id) ) : all } scope :without_projects, -> { where('id NOT IN (SELECT DISTINCT(user_id) FROM members)') } + scope :with_two_factor, -> { where(two_factor_enabled: true) } + scope :without_two_factor, -> { where(two_factor_enabled: false) } # # Class methods @@ -247,9 +250,16 @@ class User < ActiveRecord::Base def filter(filter_name) case filter_name - when "admins"; self.admins - when "blocked"; self.blocked - when "wop"; self.without_projects + when 'admins' + self.admins + when 'blocked' + self.blocked + when 'two_factor_disabled' + self.without_two_factor + when 'two_factor_enabled' + self.with_two_factor + when 'wop' + self.without_projects else self.active end @@ -316,18 +326,6 @@ class User < ActiveRecord::Base @reset_token end - # Check if the user has enabled Two-factor Authentication - def two_factor_enabled? - otp_required_for_login - end - - # Set whether or not Two-factor Authentication is enabled for the current user - # - # setting - Boolean - def two_factor_enabled=(setting) - self.otp_required_for_login = setting - end - def namespace_uniq namespace_name = self.username existing_namespace = Namespace.by_path(namespace_name) diff --git a/app/views/admin/users/index.html.haml b/app/views/admin/users/index.html.haml index 45dee86b017..9c1bec7c84d 100644 --- a/app/views/admin/users/index.html.haml +++ b/app/views/admin/users/index.html.haml @@ -13,6 +13,14 @@ = link_to admin_users_path(filter: "admins") do Admins %small.pull-right= User.admins.count + %li.filter-two-factor-enabled{class: "#{'active' if params[:filter] == 'two_factor_enabled'}"} + = link_to admin_users_path(filter: 'two_factor_enabled') do + 2FA Enabled + %small.pull-right= User.with_two_factor.count + %li.filter-two-factor-disabled{class: "#{'active' if params[:filter] == 'two_factor_disabled'}"} + = link_to admin_users_path(filter: 'two_factor_disabled') do + 2FA Disabled + %small.pull-right= User.without_two_factor.count %li{class: "#{'active' if params[:filter] == "blocked"}"} = link_to admin_users_path(filter: "blocked") do Blocked diff --git a/app/views/layouts/header/_default.html.haml b/app/views/layouts/header/_default.html.haml index 1403b86f377..b3cd7b0e37b 100644 --- a/app/views/layouts/header/_default.html.haml +++ b/app/views/layouts/header/_default.html.haml @@ -3,7 +3,8 @@ .header-logo = link_to root_path, class: 'home', title: 'Dashboard', id: 'js-shortcuts-home', data: {toggle: 'tooltip', placement: 'bottom'} do = brand_header_logo - %h3 GitLab + .gitlab-text-container + %h3 GitLab .header-content %button.navbar-toggle{type: 'button'} %span.sr-only Toggle navigation diff --git a/app/views/layouts/header/_public.html.haml b/app/views/layouts/header/_public.html.haml index 2c5884a5b6d..15c2e292be3 100644 --- a/app/views/layouts/header/_public.html.haml +++ b/app/views/layouts/header/_public.html.haml @@ -3,7 +3,8 @@ .header-logo = link_to explore_root_path, class: "home" do = brand_header_logo - %h3 GitLab + .gitlab-text-container + %h3 GitLab .header-content - unless current_controller?('sessions') .pull-right |