mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-06 01:08:21 +01:00
Removed dependency to has_secure_token to fix warnings about already initialized constant
This commit is contained in:
parent
6c1a500ffa
commit
2b95c043e3
@ -5,6 +5,7 @@
|
|||||||
- Faraday was downgraded from 1.0 to 0.17 for better compatibility with elasticsearch-ruby 5 (#205 #196)
|
- 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
|
- 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
|
- 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: 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: 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)
|
- Fix a bug: when a new account is created through the sign-up modal, the role is not reported in the StatisticProfile (#196)
|
||||||
|
1
Gemfile
1
Gemfile
@ -132,7 +132,6 @@ gem 'openlab_ruby'
|
|||||||
|
|
||||||
gem 'api-pagination'
|
gem 'api-pagination'
|
||||||
gem 'apipie-rails'
|
gem 'apipie-rails'
|
||||||
gem 'has_secure_token'
|
|
||||||
|
|
||||||
# XLS files generation
|
# XLS files generation
|
||||||
gem 'caxlsx'
|
gem 'caxlsx'
|
||||||
|
@ -179,8 +179,6 @@ GEM
|
|||||||
raabro (~> 1.1)
|
raabro (~> 1.1)
|
||||||
globalid (0.4.2)
|
globalid (0.4.2)
|
||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
has_secure_token (1.0.0)
|
|
||||||
activerecord (>= 3.0)
|
|
||||||
hashdiff (1.0.1)
|
hashdiff (1.0.1)
|
||||||
hashery (2.1.2)
|
hashery (2.1.2)
|
||||||
hashie (4.1.0)
|
hashie (4.1.0)
|
||||||
@ -484,7 +482,6 @@ DEPENDENCIES
|
|||||||
foreman
|
foreman
|
||||||
forgery
|
forgery
|
||||||
friendly_id (~> 5.1.0)
|
friendly_id (~> 5.1.0)
|
||||||
has_secure_token
|
|
||||||
icalendar
|
icalendar
|
||||||
jbuilder (~> 2.5)
|
jbuilder (~> 2.5)
|
||||||
jbuilder_cache_multi
|
jbuilder_cache_multi
|
||||||
|
@ -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
|
class OpenAPI::Client < ApplicationRecord
|
||||||
has_many :calls_count_tracings, foreign_key: :open_api_client_id, dependent: :destroy
|
has_many :calls_count_tracings, foreign_key: :open_api_client_id, dependent: :destroy
|
||||||
has_secure_token
|
|
||||||
validates :name, presence: true
|
validates :name, presence: true
|
||||||
|
validates_uniqueness_of :token
|
||||||
|
|
||||||
|
before_create :set_initial_token
|
||||||
|
|
||||||
def increment_calls_count
|
def increment_calls_count
|
||||||
update_column(:calls_count, calls_count+1)
|
update_column(:calls_count, calls_count+1)
|
||||||
end
|
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
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user