diff --git a/app/controllers/users/settings_controller.rb b/app/controllers/users/settings_controller.rb index ab657ce88..f6c8e4444 100644 --- a/app/controllers/users/settings_controller.rb +++ b/app/controllers/users/settings_controller.rb @@ -21,6 +21,12 @@ class Users::SettingsController < Users::BaseController end end + def reset_auth_token + @user.reset_authentication_token! + flash[:notice] = t("flash.user.reset_auth_token") + redirect_to profile_settings_path + end + def private if request.put? if @user.update_with_password(params[:user]) diff --git a/app/views/users/settings/private.html.haml b/app/views/users/settings/private.html.haml index d16e2707b..2eb30eeb3 100644 --- a/app/views/users/settings/private.html.haml +++ b/app/views/users/settings/private.html.haml @@ -15,6 +15,15 @@ \  .rightlist= submit_tag t('layout.save'), :data => {'disable-with' => t('layout.saving')} .both +%br + += form_for @user, :url => reset_auth_token_settings_path, :html => {:class => :form} do |f| + .leftlist= f.label :authentication_token + .rightlist= @user.authentication_token + .both + .leftlist + .rightlist= submit_tag t('layout.users.reset_token'), :data => {'disable-with' => t('layout.saving')} + .both :javascript $('article .right').addClass('middlepadding'); diff --git a/config/locales/users.en.yml b/config/locales/users.en.yml index ceab2c08d..670b678d2 100644 --- a/config/locales/users.en.yml +++ b/config/locales/users.en.yml @@ -53,3 +53,4 @@ en: company: Company avatar: Avatar avatar_file_size: Avatar file size + authentication_token: API token diff --git a/config/locales/users.ru.yml b/config/locales/users.ru.yml index e78e1cbd5..a79c1bf57 100644 --- a/config/locales/users.ru.yml +++ b/config/locales/users.ru.yml @@ -53,3 +53,4 @@ ru: company: Компания avatar: Аватар avatar_file_size: Размер аватара + authentication_token: API токен diff --git a/config/routes.rb b/config/routes.rb index 1e3b019bf..286b8cef7 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -243,6 +243,7 @@ Rosa::Application.routes.draw do put :private get :notifiers put :notifiers + put :reset_auth_token end end resources :register_requests, :only => [:new, :create], :format => /ru|en/ #view support only two languages