#192: updated tokens_controller, added token.ru.yml
This commit is contained in:
parent
9850401254
commit
32a7cdafb3
|
@ -17,7 +17,9 @@ class Platforms::TokensController < Platforms::BaseController
|
||||||
end
|
end
|
||||||
|
|
||||||
def withdraw
|
def withdraw
|
||||||
if @token.block
|
if @token.block
|
||||||
|
@token.updater = current_user
|
||||||
|
@token.save
|
||||||
redirect_to :back, :notice => t('layout.tokens.withdraw_success')
|
redirect_to :back, :notice => t('layout.tokens.withdraw_success')
|
||||||
else
|
else
|
||||||
redirect_to :back, :notice => t('layout.tokens.withdraw_fail')
|
redirect_to :back, :notice => t('layout.tokens.withdraw_fail')
|
||||||
|
|
|
@ -22,7 +22,7 @@ class Token < ActiveRecord::Base
|
||||||
|
|
||||||
def generate_token
|
def generate_token
|
||||||
self.authentication_token = loop do
|
self.authentication_token = loop do
|
||||||
token = SecureRandom.urlsafe_base64(64)
|
token = SecureRandom.urlsafe_base64(32)
|
||||||
break token unless Token.where(:authentication_token => token).exists?
|
break token unless Token.where(:authentication_token => token).exists?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
%tr
|
%tr
|
||||||
%th= t('activerecord.attributes.token.id')
|
%th= t('activerecord.attributes.token.id')
|
||||||
%th.th1= t('activerecord.attributes.token.description')
|
%th.th1= t('activerecord.attributes.token.description')
|
||||||
%th= t('layout.tokens.creator')
|
%th= t('activerecord.attributes.token.creator')
|
||||||
%th= t('activerecord.attributes.token.status')
|
%th= t('activerecord.attributes.token.status')
|
||||||
%tbody
|
%tbody
|
||||||
- @tokens.each do |token|
|
- @tokens.each do |token|
|
||||||
|
|
|
@ -28,6 +28,13 @@
|
||||||
%td
|
%td
|
||||||
%b= "#{t('activerecord.attributes.token.status')}:"
|
%b= "#{t('activerecord.attributes.token.status')}:"
|
||||||
%td= @token.status
|
%td= @token.status
|
||||||
|
%tr
|
||||||
|
%td
|
||||||
|
%b= "#{t('activerecord.attributes.token.authentication_token')}:"
|
||||||
|
%td= @token.authentication_token
|
||||||
|
|
||||||
.buttons_block
|
.buttons_block
|
||||||
= link_to I18n.t('layout.tokens.withdraw'), withdraw_platform_token_path(@platform, @token), :class => 'button left_floated'
|
= link_to t('layout.tokens.withdraw'),
|
||||||
|
withdraw_platform_token_path(@platform, @token),
|
||||||
|
:method => :post, :class => 'button',
|
||||||
|
:confirm => t('layout.tokens.withdraw_confirm')
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
ru:
|
||||||
|
layout:
|
||||||
|
tokens:
|
||||||
|
list_header: Токены
|
||||||
|
new: Новый токен
|
||||||
|
new_header: Новый токен
|
||||||
|
about: Токен платформы
|
||||||
|
withdraw: Отозвать
|
||||||
|
withdraw_confirm: Уверены, что хотите отозвать токен?
|
||||||
|
|
||||||
|
statuses:
|
||||||
|
active: Активный
|
||||||
|
blocked: Отозван
|
||||||
|
|
||||||
|
flash:
|
||||||
|
token:
|
||||||
|
saved: Токен успешно добавлен
|
||||||
|
save_error: Не удалось добавить токен
|
||||||
|
withdraw_success: Токен успешно отозван!
|
||||||
|
withdraw_fail: Не удалось отозвать токен!
|
||||||
|
|
||||||
|
activerecord:
|
||||||
|
models:
|
||||||
|
token: Токен
|
||||||
|
attributes:
|
||||||
|
token:
|
||||||
|
id: Id
|
||||||
|
description: Описание
|
||||||
|
status: Статус
|
||||||
|
authentication_token: Токен
|
||||||
|
created_at: Создан
|
||||||
|
updated_at: Обновлен
|
||||||
|
creator: Создатель
|
||||||
|
updater: Обновитель
|
Loading…
Reference in New Issue