lib/goma/config.rb in goma-0.0.1.beta vs lib/goma/config.rb in goma-0.0.1.gamma
- old
+ new
@@ -40,31 +40,35 @@
class Configuration
include Goma::Configurable
config_accessor(:default_mailer_name) { 'UserMailer' }
config_accessor(:mailer_sender)
- config_accessor(:authentication_keys) { [:email] }
- config_accessor(:email_regexp) { /\A[^@]+@[^@]+\z/ }
- config_accessor(:password_length) { 6..128 }
- config_accessor(:case_insensitive_keys) { [:email] }
- config_accessor(:strip_whitespace_keys) { [:email] }
config_accessor(:clean_up_csrf_token_on_authentication) { true }
config_accessor(:secret_key)
- config_accessor(:encryptor) { :bcrypt }
- config_accessor(:stretches) { 10 }
- config_accessor(:pepper)
config_accessor(:serialization_method) { :goma }
config_accessor(:scopes) { [:user] }
config_accessor(:default_scope) { :user }
- config_accessor(:modules) { [:password_authenticatable] }
+ config_accessor(:modules) { [] }
config_accessor(:save_return_to_url) { true }
config_accessor(:not_authenticated_action) { :not_authenticated }
+
+ # Password authenticatable
+ config_accessor(:authentication_keys) { [:email] }
+ config_accessor(:case_insensitive_keys) { [:email] }
+ config_accessor(:strip_whitespace_keys) { [:email] }
+ config_accessor(:encryptor) { :bcrypt }
+ config_accessor(:pepper)
+ config_accessor(:stretches) { 10 }
config_accessor(:email_attribute_name) { :email }
config_accessor(:password_attribute_name) { :password }
config_accessor(:encrypted_password_attribute_name) { :encrypted_password }
+ # Validatable
+ config_accessor(:password_length) { 8..128 }
+ config_accessor(:email_regexp) { /\A[^@]+@[^@]+\z/ }
+
# Confirmable
config_accessor(:activation_mailer_name) { nil }
config_accessor(:email_confirmation_mailer_name) { nil }
config_accessor(:confirmation_keys) { [ :email ] }
config_accessor(:allow_unactivated_access_for) { 0 }
@@ -84,31 +88,31 @@
# Rememberable
config_accessor(:remember_for) { 2.weeks }
config_accessor(:extend_remember_period) { false }
config_accessor(:rememberable_options) { {} }
- config_accessor(:remember_token_attribute_name) { :remember_token }
+ config_accessor(:remember_token_attribute_name) { nil }
config_accessor(:remember_created_at_attribute_name) { :remember_created_at }
# Timeoutable
config_accessor(:timeout_in) { 30.minutes }
config_accessor(:logout_all_scopes) { false }
config_accessor(:validate_session_even_in_not_login_area) { true }
# Lockable
config_accessor(:unlock_token_mailer_name) { nil }
- config_accessor(:unlock_token_email_method_name) { :unlock_email }
+ config_accessor(:unlock_token_email_method_name) { :unlock_token_email }
config_accessor(:lock_strategy) { :failed_attempts }
config_accessor(:unlock_keys) { :email }
config_accessor(:unlock_strategies) { [:email, :time] }
config_accessor(:maximum_attempts) { 20 }
config_accessor(:failed_attempts_attribute_name) { :failed_attempts }
config_accessor(:locked_at_attribute_name) { :locked_at }
+ config_accessor(:unlock_in) { 1.hour }
config_accessor(:unlock_token_attribute_name) { :unlock_token }
config_accessor(:unlock_token_sent_at_attribute_name) { :unlock_token_sent_at }
config_accessor(:unlock_token_to_send_attribute_name) { :raw_unlock_token }
- config_accessor(:unlock_in) { 1.hour }
# Recoverable
config_accessor(:reset_password_mailer_name) { nil }
config_accessor(:reset_password_email_method_name) { :reset_password_email }
config_accessor(:reset_password_keys) { [ :email ] }
@@ -123,20 +127,13 @@
config_accessor(:last_login_at_attribute_name) { :last_login_at }
config_accessor(:current_login_ip_attribute_name) { :current_login_ip }
config_accessor(:last_login_ip_attribute_name) { :last_login_ip }
# Omniauthable
- config_accessor(:oauth_providers) { {} }
config_accessor(:oauth_authentication_class_name) { 'Authentication' }
config_accessor(:oauth_provider_attribute_name) { :provider }
config_accessor(:oauth_uid_attribute_name) { :uid }
- def omniauth(provider, app_id=nil, app_secret=nil)
- oauth_providers[provider] = {key: app_id, secret: app_secret}
- end
- # TODO
- config_accessor(:salt_attribute_name) { nil }
- config_accessor(:salt_join_token) { '' }
self.instance_methods(false).grep(/attribute_name$/).each do |conf_name|
name = conf_name.to_s[0...-15]
class_eval <<-RUBY, __FILE__, __LINE__ + 1