#312: show user authentication_token

This commit is contained in:
Vokhmin Alexey V 2013-10-16 21:30:40 +04:00
parent 78b2d79648
commit 7be0129361
5 changed files with 18 additions and 0 deletions

View File

@ -21,6 +21,12 @@ class Users::SettingsController < Users::BaseController
end end
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 def private
if request.put? if request.put?
if @user.update_with_password(params[:user]) if @user.update_with_password(params[:user])

View File

@ -15,6 +15,15 @@
\  \ 
.rightlist= submit_tag t('layout.save'), :data => {'disable-with' => t('layout.saving')} .rightlist= submit_tag t('layout.save'), :data => {'disable-with' => t('layout.saving')}
.both .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 :javascript
$('article .right').addClass('middlepadding'); $('article .right').addClass('middlepadding');

View File

@ -53,3 +53,4 @@ en:
company: Company company: Company
avatar: Avatar avatar: Avatar
avatar_file_size: Avatar file size avatar_file_size: Avatar file size
authentication_token: API token

View File

@ -53,3 +53,4 @@ ru:
company: Компания company: Компания
avatar: Аватар avatar: Аватар
avatar_file_size: Размер аватара avatar_file_size: Размер аватара
authentication_token: API токен

View File

@ -243,6 +243,7 @@ Rosa::Application.routes.draw do
put :private put :private
get :notifiers get :notifiers
put :notifiers put :notifiers
put :reset_auth_token
end end
end end
resources :register_requests, :only => [:new, :create], :format => /ru|en/ #view support only two languages resources :register_requests, :only => [:new, :create], :format => /ru|en/ #view support only two languages