1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-29 18:52:22 +01:00

Removed dependency to has_secure_token to fix warnings about already initialized constant

This commit is contained in:
Sylvain 2020-05-18 17:45:01 +02:00
parent 6c1a500ffa
commit 2b95c043e3
4 changed files with 22 additions and 5 deletions

View File

@ -5,6 +5,7 @@
- Faraday was downgraded from 1.0 to 0.17 for better compatibility with elasticsearch-ruby 5 (#205 #196)
- Added [an option](doc/environment.md#ALLOW_INSECURE_HTTP) to allow usage in production without HTTPS
- Now using node.js instead of therubyracer for building javascript assets
- Removed dependency to has_secure_token to fix warnings about already initialized constant
- Fix a bug: when an admin logs on the subscription page, his view is broken
- Fix a bug: admin's members list shows the same members multiple times
- Fix a bug: when a new account is created through the sign-up modal, the role is not reported in the StatisticProfile (#196)

View File

@ -132,7 +132,6 @@ gem 'openlab_ruby'
gem 'api-pagination'
gem 'apipie-rails'
gem 'has_secure_token'
# XLS files generation
gem 'caxlsx'

View File

@ -179,8 +179,6 @@ GEM
raabro (~> 1.1)
globalid (0.4.2)
activesupport (>= 4.2.0)
has_secure_token (1.0.0)
activerecord (>= 3.0)
hashdiff (1.0.1)
hashery (2.1.2)
hashie (4.1.0)
@ -484,7 +482,6 @@ DEPENDENCIES
foreman
forgery
friendly_id (~> 5.1.0)
has_secure_token
icalendar
jbuilder (~> 2.5)
jbuilder_cache_multi

View File

@ -1,9 +1,29 @@
# frozen_string_literal: true
# OpenAPI::Client keeps track of the authorized accesses to the 3-rd party API (aka. OpenAPI)
class OpenAPI::Client < ApplicationRecord
has_many :calls_count_tracings, foreign_key: :open_api_client_id, dependent: :destroy
has_secure_token
validates :name, presence: true
validates_uniqueness_of :token
before_create :set_initial_token
def increment_calls_count
update_column(:calls_count, calls_count+1)
end
def regenerate_token
update_attributes(token: generate_unique_secure_token)
end
private
def set_initial_token
self.token = generate_unique_secure_token
end
def generate_unique_secure_token
SecureRandom.base58(24)
end
end