#192: updated tokens_controller, added token.ru.yml
This commit is contained in:
parent
9850401254
commit
32a7cdafb3
|
@ -18,6 +18,8 @@ class Platforms::TokensController < Platforms::BaseController
|
|||
|
||||
def withdraw
|
||||
if @token.block
|
||||
@token.updater = current_user
|
||||
@token.save
|
||||
redirect_to :back, :notice => t('layout.tokens.withdraw_success')
|
||||
else
|
||||
redirect_to :back, :notice => t('layout.tokens.withdraw_fail')
|
||||
|
|
|
@ -22,7 +22,7 @@ class Token < ActiveRecord::Base
|
|||
|
||||
def generate_token
|
||||
self.authentication_token = loop do
|
||||
token = SecureRandom.urlsafe_base64(64)
|
||||
token = SecureRandom.urlsafe_base64(32)
|
||||
break token unless Token.where(:authentication_token => token).exists?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
%tr
|
||||
%th= t('activerecord.attributes.token.id')
|
||||
%th.th1= t('activerecord.attributes.token.description')
|
||||
%th= t('layout.tokens.creator')
|
||||
%th= t('activerecord.attributes.token.creator')
|
||||
%th= t('activerecord.attributes.token.status')
|
||||
%tbody
|
||||
- @tokens.each do |token|
|
||||
|
|
|
@ -28,6 +28,13 @@
|
|||
%td
|
||||
%b= "#{t('activerecord.attributes.token.status')}:"
|
||||
%td= @token.status
|
||||
%tr
|
||||
%td
|
||||
%b= "#{t('activerecord.attributes.token.authentication_token')}:"
|
||||
%td= @token.authentication_token
|
||||
|
||||
.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