-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve setup of an authentication key.
- Loading branch information
1 parent
d05dff3
commit ed4cdf5
Showing
3 changed files
with
19 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,13 @@ | ||
::CurrentUser.setup do |config| | ||
|
||
# Setup an authentication key | ||
# If you want just remove the code block belong and | ||
# setup the key: config.authentication_key = '4242424242424242' | ||
key_file_path = File.expand_path 'config/current_user/key', Rails.root | ||
if File.exist? key_file_path | ||
key = File.open(key_file_path) { |f| f.readline } | ||
config.authentication_key = key | ||
end | ||
# Setup an authentication key. | ||
# If you want to have a custom key, it might look like: | ||
# config.authentication_key = '4242424242424242' | ||
config.authentication_key = ::CurrentUser.read_authentication_key | ||
|
||
# Setup how users might be distinguished via UI. | ||
# It might be a symbol, a string or a lambda. | ||
# If it is a symbol or a string, there should be | ||
# a database column with the same name. | ||
# If 'identifier' is lambda it might be written as: | ||
# config.identifier = lambda { |u| "User with email '#{u.email}'" } | ||
# For the last case it might be: | ||
# config.identifier = -> { |u| "User with email #{u.email}" } | ||
config.identifier = :email | ||
end | ||
end |