Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
gitlab-ce
Commits
ffe111c1
Commit
ffe111c1
authored
Jun 03, 2016
by
Timothy Andrew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Display appropriate errors when personal access token creation/revocation fails.
parent
399a6330
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
app/controllers/profiles/personal_access_tokens_controller.rb
...controllers/profiles/personal_access_tokens_controller.rb
+9
-3
app/views/profiles/personal_access_tokens/index.html.haml
app/views/profiles/personal_access_tokens/index.html.haml
+2
-0
No files found.
app/controllers/profiles/personal_access_tokens_controller.rb
View file @
ffe111c1
class
Profiles::PersonalAccessTokensController
<
Profiles
::
ApplicationController
before_action
:load_personal_access_tokens
,
only: :index
def
index
@active_personal_access_tokens
=
current_user
.
personal_access_tokens
.
active
.
order
(
:expires_at
)
@inactive_personal_access_tokens
=
current_user
.
personal_access_tokens
.
inactive
@personal_access_token
=
current_user
.
personal_access_tokens
.
build
end
...
...
@@ -12,6 +12,7 @@ class Profiles::PersonalAccessTokensController < Profiles::ApplicationController
flash
[
:personal_access_token
]
=
@personal_access_token
.
token
redirect_to
profile_personal_access_tokens_path
else
load_personal_access_tokens
render
:index
end
end
...
...
@@ -22,7 +23,7 @@ class Profiles::PersonalAccessTokensController < Profiles::ApplicationController
if
@personal_access_token
.
revoke!
redirect_to
profile_personal_access_tokens_path
,
notice:
"Revoked personal access token
#{
@personal_access_token
.
name
}
!"
else
re
nder
:index
re
direct_to
profile_personal_access_tokens_path
,
alert:
"Could not revoke personal access token
#{
@personal_access_token
.
name
}
."
end
end
...
...
@@ -31,4 +32,9 @@ class Profiles::PersonalAccessTokensController < Profiles::ApplicationController
def
personal_access_token_params
params
.
require
(
:personal_access_token
).
permit
(
:name
,
:expires_at
)
end
def
load_personal_access_tokens
@active_personal_access_tokens
=
current_user
.
personal_access_tokens
.
active
.
order
(
:expires_at
)
@inactive_personal_access_tokens
=
current_user
.
personal_access_tokens
.
inactive
end
end
app/views/profiles/personal_access_tokens/index.html.haml
View file @
ffe111c1
...
...
@@ -24,6 +24,8 @@
=
form_for
[
:profile
,
@personal_access_token
],
method: :post
,
html:
{
class:
'js-requires-input'
}
do
|
f
|
=
form_errors
(
@personal_access_token
)
.form-group
=
f
.
label
:name
,
class:
'label-light'
=
f
.
text_field
:name
,
class:
"form-control"
,
required:
true
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment