diff options
author | Timothy Andrew <mail@timothyandrew.net> | 2016-04-15 13:06:44 +0530 |
---|---|---|
committer | Timothy Andrew <mail@timothyandrew.net> | 2016-04-28 22:28:36 +0530 |
commit | 3a609038748055a27c7e01cf4b55d8249709c9cc (patch) | |
tree | b6ec5626549f2c423b958b8ebc3c08061388a4ca /app/controllers/profiles | |
parent | 973b948b9e9553a57113983fa4e32207b581e0ad (diff) | |
download | gitlab-ce-3a609038748055a27c7e01cf4b55d8249709c9cc.tar.gz |
Allow creating Personal Access Tokens through the website.
Diffstat (limited to 'app/controllers/profiles')
-rw-r--r-- | app/controllers/profiles/personal_access_tokens_controller.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/app/controllers/profiles/personal_access_tokens_controller.rb b/app/controllers/profiles/personal_access_tokens_controller.rb new file mode 100644 index 00000000000..dbf06cb4c6d --- /dev/null +++ b/app/controllers/profiles/personal_access_tokens_controller.rb @@ -0,0 +1,22 @@ +class Profiles::PersonalAccessTokensController < ApplicationController + def index + @user = current_user + @personal_access_token = current_user.personal_access_tokens.new + end + + def create + @personal_access_token = current_user.personal_access_tokens.generate(personal_access_token_params) + + if @personal_access_token.save + redirect_to profile_personal_access_tokens_path, notice: "Created personal access token!" + else + render :index + end + end + + private + + def personal_access_token_params + params.require(:personal_access_token).permit(:name) + end +end |