diff options
author | Timothy Andrew <mail@timothyandrew.net> | 2016-06-01 14:31:16 +0530 |
---|---|---|
committer | Timothy Andrew <mail@timothyandrew.net> | 2016-06-01 14:31:16 +0530 |
commit | c75aea5e4dc6f4420e7576a5c367a9e035f63646 (patch) | |
tree | 41433f83b0a77a5da344abdd66d2854ac8228de7 /app/controllers/profiles | |
parent | 6d444331764fec1910d15b300d89b6246a1f83ea (diff) | |
download | gitlab-ce-c75aea5e4dc6f4420e7576a5c367a9e035f63646.tar.gz |
Fix minor issues with the personal access tokens implementation.
- Use the `:personal_access_token` param root instead of
`personal_access_token_params`, because we aren't using the
`personal_access_token` param for authentication anymore (we're using
`private_token` instead).
- Use `build` to instantiate a `PersonalAccessToken`
- Use better-formatted dates
Diffstat (limited to 'app/controllers/profiles')
-rw-r--r-- | app/controllers/profiles/personal_access_tokens_controller.rb | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/app/controllers/profiles/personal_access_tokens_controller.rb b/app/controllers/profiles/personal_access_tokens_controller.rb index af6def25e7f..1ad1c11b73f 100644 --- a/app/controllers/profiles/personal_access_tokens_controller.rb +++ b/app/controllers/profiles/personal_access_tokens_controller.rb @@ -2,7 +2,7 @@ class Profiles::PersonalAccessTokensController < Profiles::ApplicationController 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 = PersonalAccessToken.new(user: @user) + @personal_access_token = current_user.personal_access_tokens.build end def create @@ -28,8 +28,6 @@ class Profiles::PersonalAccessTokensController < Profiles::ApplicationController private def personal_access_token_params - # We aren't using `personal_access_token` as the root param because the authentication - # system expects to find a token string there - it's off-limits to us. - params.require(:personal_access_token_params).permit(:name, :expires_at) + params.require(:personal_access_token).permit(:name, :expires_at) end end |