2016-04-15 03:36:44 -04:00
- page_title "Personal Access Tokens"
2016-06-30 12:42:07 -04:00
= render 'profiles/head'
2016-04-15 03:36:44 -04:00
.row.prepend-top-default
.col-lg-3.profile-settings-sidebar
%h4.prepend-top-0
= page_title
%p
2016-06-02 23:37:37 -04:00
You can generate a personal access token for each application you use that needs access to the GitLab API.
2016-08-10 20:04:25 -04:00
%p
2016-08-17 18:21:18 -04:00
You can also use personal access tokens to authenticate against Git over HTTP.
They are the only accepted password when you have Two-Factor Authentication (2FA) enabled.
2016-08-10 20:04:25 -04:00
2016-04-15 03:36:44 -04:00
.col-lg-9
2016-06-01 22:57:47 -04:00
- if flash[:personal_access_token]
2016-06-09 23:19:05 -04:00
.created-personal-access-token-container
2016-06-09 04:38:49 -04:00
%h5.prepend-top-0
Your New Personal Access Token
.form-group
2016-06-09 23:19:05 -04:00
= text_field_tag 'created-personal-access-token', flash[:personal_access_token], readonly: true, class: "form-control", 'aria-describedby' => "created-personal-access-token-help-block"
2017-01-11 15:40:51 -05:00
= clipboard_button(clipboard_text: flash[:personal_access_token], title: "Copy personal access token to clipboard", placement: "left")
2016-06-09 23:19:05 -04:00
%span#created-personal-access-token-help-block.help-block.text-danger Make sure you save it - you won't be able to access it again.
2016-06-09 04:38:49 -04:00
%hr
2016-06-01 22:57:47 -04:00
2016-04-15 03:36:44 -04:00
%h5.prepend-top-0
Add a Personal Access Token
%p.profile-settings-content
Pick a name for the application, and we'll give you a unique token.
2016-12-04 23:19:51 -05:00
= render "form", personal_access_token: @personal_access_token, scopes: @scopes
2016-04-15 03:36:44 -04:00
%hr
2016-06-01 05:01:16 -04:00
%h5 Active Personal Access Tokens (#{@active_personal_access_tokens.length})
2016-04-15 03:36:44 -04:00
2016-04-20 04:50:24 -04:00
- if @active_personal_access_tokens.present?
2016-04-15 03:36:44 -04:00
.table-responsive
2016-06-09 04:38:49 -04:00
%table.table.active-personal-access-tokens
2016-04-15 03:36:44 -04:00
%thead
%tr
%th Name
2016-04-19 05:58:35 -04:00
%th Created
%th Expires
2016-11-22 03:57:31 -05:00
%th Scopes
2016-06-02 23:37:37 -04:00
%th
2016-04-15 03:36:44 -04:00
%tbody
2016-04-20 04:50:24 -04:00
- @active_personal_access_tokens.each do |token|
2016-04-15 03:36:44 -04:00
%tr
%td= token.name
2016-06-01 05:01:16 -04:00
%td= token.created_at.to_date.to_s(:medium)
2016-06-02 23:37:37 -04:00
%td
- if token.expires_at.present?
= token.expires_at.to_date.to_s(:medium)
- else
2016-04-18 06:18:54 -04:00
%span.personal-access-tokens-never-expires-label Never
2016-11-22 03:57:31 -05:00
%td= token.scopes.present? ? token.scopes.join(", ") : "<no scopes selected>"
2016-06-15 22:54:13 -04:00
%td= link_to "Revoke", revoke_profile_personal_access_token_path(token), method: :put, class: "btn btn-danger pull-right", data: { confirm: "Are you sure you want to revoke this token? This action cannot be undone." }
2016-04-15 11:24:20 -04:00
2016-04-15 03:36:44 -04:00
- else
2016-06-02 23:37:37 -04:00
.settings-message.text-center
You don't have any active tokens yet.
2016-04-19 05:58:35 -04:00
%hr
2016-06-01 05:01:16 -04:00
%h5 Inactive Personal Access Tokens (#{@inactive_personal_access_tokens.length})
2016-04-19 05:58:35 -04:00
2016-04-20 04:50:24 -04:00
- if @inactive_personal_access_tokens.present?
2016-04-19 05:58:35 -04:00
.table-responsive
2016-06-09 04:38:49 -04:00
%table.table.inactive-personal-access-tokens
2016-04-19 05:58:35 -04:00
%thead
%tr
%th Name
%th Created
%tbody
2016-04-20 04:50:24 -04:00
- @inactive_personal_access_tokens.each do |token|
2016-04-19 05:58:35 -04:00
%tr
%td= token.name
2016-06-01 05:01:16 -04:00
%td= token.created_at.to_date.to_s(:medium)
2016-04-19 05:58:35 -04:00
- else
2016-06-02 23:37:37 -04:00
.settings-message.text-center
There are no inactive tokens.
2016-04-19 05:58:35 -04:00
2016-04-18 06:18:54 -04:00
:javascript
2017-01-03 12:13:12 -05:00
var $dateField = $('#personal_access_token_expires_at');
var date = $dateField.val();
new Pikaday({
field: $dateField.get(0),
2017-01-04 11:53:41 -05:00
theme: 'gitlab-theme',
2017-02-14 16:45:36 -05:00
format: 'yyyy-mm-dd',
2017-01-03 12:13:12 -05:00
minDate: new Date(),
onSelect: function(dateText) {
$dateField.val(dateFormat(new Date(dateText), 'yyyy-mm-dd'));
}
2016-06-09 04:38:49 -04:00
});
$("#created-personal-access-token").click(function() {
this.select();
});