a2ce5188fb
Allow creating Personal Access Tokens through the website Related to #2979 - Allow a user to create personal access tokens, and use them to authenticate - Refactor `API::Helpers` into `API::Helpers::Core` and `API::Helpers::Authentication` # Tasks - [ ] #2979 (!3749) - Personal Access Tokens - [x] Basic Implementation - [x] Add UI to add "Personal Access Tokens" - [x] Reload `lib/api` on every request - [x] Respect these tokens for API requests - [x] Just a param or a header too? - [x] Allow revoking tokens - [x] Expire tokens - [x] Left bar should have a "PAT" icon - [x] Scopes? - [x] Copy to Clipboard - [x] Show active/inactive tokens separately - [x] No need to check for expired/revoked in the appropriate places - [x] Why does regular ApplicationController check for private token? - [x] Support non-API requests - [x] Revert (or work on) `lib/api` eager loading - [x] Create MR - [x] Refactoring - [x] Fix tests - [x] Write more tests - [x] Add screenshots to MR - [x] Add description of query performance to MR - [x] Limit the number of queries in the `personal_access_tokens` page - [x] Wait for CI to pass - [x] Fix merge issues in schema.rb - [x] Assign MR to endboss - [x] Wait for feedback - [x] Fix feedback - [x] Wait for CI to pass - [x] Assign to @rspeicher - [x] Fix @rspeicher's comments - [x] Wait for CI to pass - [x] Assign back to @rspeicher - [x] Write documentation and ping @axil - [x] Wait for Axil to respond - [x] Assign to endboss - [x] Address Douwe's feedback - [x] Use the `private_token` or `authentication_token` param instead of `personal_access_token` - [x] Ditto for the header - [x] Assign to endboss - [x] Make sure CI is green - [x] Address Douwe's feedback - [x] Don't go through the `authenticate_user_from_private_token!` method, if a private token is supplied (or combine them) - [x] In `authenticate_user_from_personal_access_token!` don't hit DB if `token_string` is `nil` - [x] Use `current_user.personal_access_tokens.build` in the controller - [x] Remove the "We aren't using `personal_access_token` as the root param" comment - [x] `No need for = "...", we can just have the Inactive ... #{...} on the next line` in the view - [x] Render dates in a (more) human format - [x] CSS issue with table - [x] Don't show the tokens in the UI indefinitely - [x] How to implement scopes? Add-on to current impl? Doorkeeper? - [x] Wait for @DouweM's comments about scopes - [x] Address @DouweM's second review - [x] Try not using `native['innerHTML']` - [x] use contexts for all "when ..." - [x] Ensure consistency (styling) with other pages for "You don't have any tokens" message - [x] "Actions" table column doesn't need a label - [x] %td can be moved outside of the if/else statement - [x] The header title should be "Profile Settings" - [x] Can this be a `before_create`, so we don't need to use `generate`? - [x] If it couldn't be revoked, will we show an error? - [x] If it couldn't be saved, will we show an error? - [x] Merge master - [x] Update CHANGELOG entry - [x] Add tests for form errors? - [x] Post screenshots - [x] Tag @jschatz1 for review - [x] Wait for [build](https://gitlab.com/gitlab-org/gitlab-ce/commit/0dff6fd/builds) to pass - [x] Respond to @jschatz1's comments - [x] Hardcoded colors should be variables - [x] Should not be allowed to chose a date in the past - [x] Use the same table as in the Applications tab - [x] button should say "Create Personal Access Token" - [x] Float the revoke to the right on the `a` - [x] Change revocation message. "Are you sure you want to revoke this certificate? This action cannot be undone." - [x] Date stays selected and looks selected even though date is set as "never". - [x] ~~hover on the calendar button shifts~~ (not caused by this MR - happens on `milestones#new` as well) - [x] Don't use the panel for the created token - [x] Use a normal flash for "Your new personal access token has been created" - [x] Show the input (with the token) below it full width. - [x] Put the "Make sure you save it - you won't be able to access it again." message near the input - [x] Have the input highlight all on single click - [x] Update screenshots - [x] Merge master in + conflicts - [x] Assign to @jschatz1 again - [x] Respond to @jschatz1's comments - [x] No button for clipboard, only link - [x] text-danger - [x] highlight fade on that area where the token was created - [x] Make sure [build](d754d99179/builds
) is green - [x] Assign to @jschatz1 - [x] Wait for [build](faa0e3f758/builds
) to pass - [x] Respond to @DouweM's feedback - [x] move the redirect_to out of the if/else - [x] certificate -> token - [x] datepicker back to text field - [x] combine the get_user_from_private_token and get_user_from_personal_access_token methods in ApplicationController - [x] combine the get_user_from_private_token and get_user_from_personal_access_token methods in `lib/api/helpers` - [x] don't need the new constants - [x] Wait for [build](9d7cda3ddc/builds
) to pass - [ ] Wait for merge # Screenshots ![Screen_Shot_2016-06-16_at_8.30.33_AM](/uploads/30a168964b7c5e0eb322705747829fb6/Screen_Shot_2016-06-16_at_8.30.33_AM.png) ![Screen_Shot_2016-06-16_at_8.30.44_AM](/uploads/7a8202885df6120071bbe81b215aaead/Screen_Shot_2016-06-16_at_8.30.44_AM.png) ![Screen_Shot_2016-06-16_at_8.31.02_AM](/uploads/6905c0848864e390138b771389c7a1b2/Screen_Shot_2016-06-16_at_8.31.02_AM.png) ![Screen_Shot_2016-06-16_at_8.31.29_AM](/uploads/0bc92369fb2f9bc335773f6abec421c3/Screen_Shot_2016-06-16_at_8.31.29_AM.png) See merge request !3749
277 lines
6 KiB
SCSS
277 lines
6 KiB
SCSS
/*
|
|
* Layout
|
|
*/
|
|
$sidebar_collapsed_width: 62px;
|
|
$sidebar_width: 220px;
|
|
$gutter_collapsed_width: 62px;
|
|
$gutter_width: 290px;
|
|
$gutter_inner_width: 258px;
|
|
$sidebar-transition-duration: .15s;
|
|
$sidebar-breakpoint: 1440px;
|
|
|
|
/*
|
|
* UI elements
|
|
*/
|
|
$border-color: #e5e5e5;
|
|
$focus-border-color: #3aabf0;
|
|
$table-border-color: #f0f0f0;
|
|
$background-color: #fafafa;
|
|
|
|
/*
|
|
* Text
|
|
*/
|
|
$gl-font-size: 15px;
|
|
$gl-title-color: #333;
|
|
$gl-text-color: #5c5c5c;
|
|
$gl-text-green: #4a2;
|
|
$gl-text-red: #d12f19;
|
|
$gl-text-orange: #d90;
|
|
$gl-link-color: #3084bb;
|
|
$gl-dark-link-color: #333;
|
|
$gl-placeholder-color: #8f8f8f;
|
|
$gl-icon-color: $gl-placeholder-color;
|
|
$gl-grayish-blue: #7f8fa4;
|
|
$gl-gray: $gl-text-color;
|
|
$gl-gray-dark: #313236;
|
|
$gl-header-color: $gl-title-color;
|
|
|
|
/*
|
|
* Lists
|
|
*/
|
|
$list-font-size: $gl-font-size;
|
|
$list-title-color: $gl-title-color;
|
|
$list-text-color: $gl-text-color;
|
|
|
|
/*
|
|
* Markdown
|
|
*/
|
|
$md-text-color: $gl-text-color;
|
|
$md-link-color: $gl-link-color;
|
|
|
|
/*
|
|
* Code
|
|
*/
|
|
$code_font_size: 13px;
|
|
$code_line_height: 1.5;
|
|
|
|
/*
|
|
* Padding
|
|
*/
|
|
$gl-padding: 16px;
|
|
$gl-btn-padding: 10px;
|
|
$gl-input-padding: 10px;
|
|
$gl-vert-padding: 6px;
|
|
$gl-padding-top: 10px;
|
|
|
|
/*
|
|
* Misc
|
|
*/
|
|
$row-hover: #f7faff;
|
|
$row-hover-border: #b2d7ff;
|
|
$progress-color: #c0392b;
|
|
$avatar_radius: 50%;
|
|
$header-height: 50px;
|
|
$fixed-layout-width: 1280px;
|
|
$gl-avatar-size: 40px;
|
|
$error-exclamation-point: #e62958;
|
|
$border-radius-default: 2px;
|
|
$btn-transparent-color: #8f8f8f;
|
|
$settings-icon-size: 18px;
|
|
$provider-btn-group-border: #e5e5e5;
|
|
$provider-btn-not-active-color: #4688f1;
|
|
$link-underline-blue: #4a8bee;
|
|
$layout-link-gray: #7e7c7c;
|
|
$todo-alert-blue: #428bca;
|
|
$btn-side-margin: 10px;
|
|
$btn-sm-side-margin: 7px;
|
|
$btn-xs-side-margin: 5px;
|
|
|
|
/*
|
|
* Color schema
|
|
*/
|
|
|
|
$white-light: #fff;
|
|
$white-normal: #ededed;
|
|
$white-dark: #ececec;
|
|
|
|
$gray-light: #faf9f9;
|
|
$gray-normal: #f5f5f5;
|
|
$gray-dark: #ededed;
|
|
$gray-darkest: #c9c9c9;
|
|
|
|
$green-light: #38ae67;
|
|
$green-normal: #2faa60;
|
|
$green-dark: #2ca05b;
|
|
|
|
$blue-light: #2ea8e5;
|
|
$blue-normal: #2d9fd8;
|
|
$blue-dark: #2897ce;
|
|
|
|
$blue-medium-light: #3498cb;
|
|
$blue-medium: #2f8ebf;
|
|
$blue-medium-dark: #2d86b4;
|
|
|
|
$orange-light: #fc8a51;
|
|
$orange-normal: #e75e40;
|
|
$orange-dark: #ce5237;
|
|
|
|
$red-light: #e52c5a;
|
|
$red-normal: #d22852;
|
|
$red-dark: darken($red-normal, 5%);
|
|
|
|
$black: #000;
|
|
$black-transparent: rgba(0, 0, 0, 0.3);
|
|
|
|
$border-white-light: #f1f2f4;
|
|
$border-white-normal: #d6dae2;
|
|
$border-white-dark: #c6cacf;
|
|
|
|
$border-gray-light: #dcdcdc;
|
|
$border-gray-normal: #d7d7d7;
|
|
$border-gray-dark: #c6cacf;
|
|
|
|
$border-green-light: #2faa60;
|
|
$border-green-normal: #2ca05b;
|
|
$border-green-dark: #279654;
|
|
|
|
$border-blue-light: #2d9fd8;
|
|
$border-blue-normal: #2897ce;
|
|
$border-blue-dark: #258dc1;
|
|
|
|
$border-orange-light: #fc6d26;
|
|
$border-orange-normal: #ce5237;
|
|
$border-orange-dark: #c14e35;
|
|
|
|
$border-red-light: #d22852;
|
|
$border-red-normal: #ca264f;
|
|
$border-red-dark: darken($border-red-normal, 5%);
|
|
|
|
$help-well-bg: #fafafa;
|
|
$help-well-border: #e5e5e5;
|
|
|
|
$warning-message-bg: #fbf2d9;
|
|
$warning-message-color: #9e8e60;
|
|
$warning-message-border: #f0e2bb;
|
|
|
|
/* header */
|
|
$light-grey-header: #faf9f9;
|
|
|
|
/* tanuki logo colors */
|
|
$tanuki-red: #e24329;
|
|
$tanuki-orange: #fc6d26;
|
|
$tanuki-yellow: #fca326;
|
|
|
|
/*
|
|
* State colors:
|
|
*/
|
|
$gl-primary: $blue-normal;
|
|
$gl-success: $green-normal;
|
|
$gl-success-focus: rgba($gl-success, .4);
|
|
$gl-info: $blue-normal;
|
|
$gl-warning: $orange-normal;
|
|
$gl-danger: $red-normal;
|
|
$gl-btn-active-background: rgba(0, 0, 0, 0.16);
|
|
$gl-btn-active-gradient: inset 0 2px 3px $gl-btn-active-background;
|
|
|
|
/*
|
|
* Commit Diff Colors
|
|
*/
|
|
$added: #63c363;
|
|
$deleted: #f77;
|
|
$line-added: #ecfdf0;
|
|
$line-added-dark: #c7f0d2;
|
|
$line-removed: #fbe9eb;
|
|
$line-removed-dark: #fac5cd;
|
|
$line-number-old: #f9d7dc;
|
|
$line-number-new: #ddfbe6;
|
|
$line-number-select: #fbf2da;
|
|
$match-line: #fafafa;
|
|
$table-border-gray: #f0f0f0;
|
|
$line-target-blue: #eaf3fc;
|
|
$line-select-yellow: #fcf8e7;
|
|
$line-select-yellow-dark: #f0e2bd;
|
|
|
|
/*
|
|
* Fonts
|
|
*/
|
|
$monospace_font: 'Menlo', 'Liberation Mono', 'Consolas', 'DejaVu Sans Mono', 'Ubuntu Mono', 'Courier New', 'andale mono', 'lucida console', monospace;
|
|
$regular_font: 'Source Sans Pro', "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
|
|
/*
|
|
* Dropdowns
|
|
*/
|
|
$dropdown-width: 300px;
|
|
$dropdown-bg: #fff;
|
|
$dropdown-link-color: #555;
|
|
$dropdown-link-hover-bg: $row-hover;
|
|
$dropdown-empty-row-bg: rgba(#000, .04);
|
|
$dropdown-border-color: rgba(#000, .1);
|
|
$dropdown-shadow-color: rgba(#000, .1);
|
|
$dropdown-divider-color: rgba(#000, .1);
|
|
$dropdown-header-color: #959494;
|
|
$dropdown-title-btn-color: #bfbfbf;
|
|
$dropdown-input-color: #555;
|
|
$dropdown-input-focus-border: $focus-border-color;
|
|
$dropdown-input-focus-shadow: rgba($dropdown-input-focus-border, .4);
|
|
$dropdown-loading-bg: rgba(#fff, .6);
|
|
|
|
$dropdown-toggle-bg: #fff;
|
|
$dropdown-toggle-color: #626262;
|
|
$dropdown-toggle-border-color: #eaeaea;
|
|
$dropdown-toggle-hover-border-color: darken($dropdown-toggle-border-color, 15%);
|
|
$dropdown-toggle-icon-color: #c4c4c4;
|
|
$dropdown-toggle-hover-icon-color: $dropdown-toggle-hover-border-color;
|
|
|
|
/*
|
|
* Buttons
|
|
*/
|
|
$btn-active-gray: #ececec;
|
|
$btn-placeholder-gray: #c7c7c7;
|
|
$btn-white-active: #848484;
|
|
$btn-gray-hover: #eee;
|
|
|
|
/*
|
|
* Award emoji
|
|
*/
|
|
$award-emoji-menu-bg: #fff;
|
|
$award-emoji-menu-border: #f1f2f4;
|
|
$award-emoji-new-btn-icon-color: #dcdcdc;
|
|
|
|
/*
|
|
* Search Box
|
|
*/
|
|
$search-input-border-color: rgba(#4688f1, .8);
|
|
$search-input-focus-shadow-color: $dropdown-input-focus-shadow;
|
|
$search-input-width: 244px;
|
|
$location-badge-color: #aaa;
|
|
$location-badge-bg: $gray-normal;
|
|
$location-badge-active-bg: #4f91f8;
|
|
$location-icon-color: #e7e9ed;
|
|
$location-icon-active-color: #807e7e;
|
|
|
|
/*
|
|
* Notes
|
|
*/
|
|
$notes-light-color: #8e8e8e;
|
|
$notes-action-color: #c3c3c3;
|
|
$notes-role-color: #8e8e8e;
|
|
$notes-role-border-color: #e4e4e4;
|
|
|
|
$note-disabled-comment-color: #b2b2b2;
|
|
$note-form-border-color: #e5e5e5;
|
|
$note-toolbar-color: #959494;
|
|
|
|
$zen-control-hover-color: #111;
|
|
|
|
$calendar-header-color: #b8b8b8;
|
|
$calendar-hover-bg: #ecf3fe;
|
|
$calendar-border-color: rgba(#000, .1);
|
|
$calendar-unselectable-bg: #faf9f9;
|
|
|
|
/*
|
|
* Personal Access Tokens
|
|
*/
|
|
$personal-access-tokens-disabled-label-color: #bbb;
|
|
|
|
$ci-output-bg: #1d1f21;
|
|
$ci-text-color: #c5c8c6;
|