File tree Expand file tree Collapse file tree 4 files changed +7
-17
lines changed Expand file tree Collapse file tree 4 files changed +7
-17
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ gem 'devise'
1919gem 'simple_token_authentication' , '~> 1.0'
2020gem 'cancancan'
2121gem 'stripe' , '1.20.1'
22+ gem 'has_secure_token'
2223
2324group :development , :test do
2425 gem 'pry-rails'
Original file line number Diff line number Diff line change 7272 railties (>= 3.0.0 )
7373 globalid (0.3.5 )
7474 activesupport (>= 4.1.0 )
75+ has_secure_token (1.0.0 )
76+ activerecord (>= 3.0 )
7577 hashie (3.4.1 )
7678 http-cookie (1.0.2 )
7779 domain_name (~> 0.5 )
@@ -199,6 +201,7 @@ DEPENDENCIES
199201 devise
200202 dotenv-rails
201203 factory_girl_rails
204+ has_secure_token
202205 hashie
203206 pg
204207 pry
Original file line number Diff line number Diff line change @@ -13,4 +13,4 @@ class Team < ActiveRecord::Base
1313 delegate :name , to : :plan , prefix : true
1414 delegate :slug , to : :plan , prefix : true
1515
16- end
16+ end
Original file line number Diff line number Diff line change 11class User < ActiveRecord ::Base
2+ has_secure_token :authentication_token
23 acts_as_token_authenticatable
3-
4+
45 # Include default devise modules. Others available are:
56 # :confirmable, :lockable, :timeoutable and :omniauthable
67 devise :database_authenticatable , :registerable ,
78 :recoverable , :trackable , :validatable
89
9- before_save :ensure_authentication_token
10-
1110 has_many :team_memberships
1211 has_many :teams , through : :team_memberships
13-
14- def ensure_authentication_token
15- if authentication_token . blank?
16- self . authentication_token = generate_authentication_token
17- end
18- end
19-
20- private
21-
22- def generate_authentication_token
23- Devise . friendly_token
24- end
25-
2612end
You can’t perform that action at this time.
0 commit comments