Skip to content

Commit

Permalink
Added optional editor login support back in
Browse files Browse the repository at this point in the history
  • Loading branch information
cykod committed Mar 2, 2010
1 parent 01a412b commit 39d3fe5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/models/end_user.rb
Expand Up @@ -118,6 +118,10 @@ class EndUser < DomainModel
[ 'Import', 'import' ],
[ 'Referrel', 'referrel' ] ]

if CMS_EDITOR_LOGIN_SUPPORT
after_save :update_editor_login
end

def after_create #:nodoc:
if @tag_cache
self.tag(@tag_cache)
Expand All @@ -127,7 +131,6 @@ def after_create #:nodoc:
## Validation Fucntions



def before_validation #:nodoc:
self.email = self.email.downcase unless self.email.blank?
end
Expand Down Expand Up @@ -474,9 +477,10 @@ def before_save #:nodoc:
end

def update_editor_login #:nodoc:
if self.editor?
if self.registered? && self.activated? && self.editor?
editor_login= EditorLogin.find_by_domain_id_and_email(Configuration.domain_id,self.email) || EditorLogin.new
editor_login.update_attributes(:domain_id => Configuration.domain_id,
:login_hash => self.class.generate_hash,
:email => self.email,
:end_user_id => self.id,
:hashed_password => self.hashed_password)
Expand Down
2 changes: 2 additions & 0 deletions config/environment.rb
Expand Up @@ -32,6 +32,8 @@
CMS_DEFAULT_DOMAIN = defaults_config_file['domain']

CMS_SYSTEM_ADMIN_EMAIL = defaults_config_file['system_admin']

CMS_EDITOR_LOGIN_SUPPORT = defaults_config_file['editor_login'] || false

DEFAULT_DATETIME_FORMAT = defaults_config_file['default_datetime_format'] || "%m/%d/%Y %I:%M %p"
DEFAULT_DATE_FORMAT = defaults_config_file['default_date_format'] || "%m/%d/%Y"
Expand Down

0 comments on commit 39d3fe5

Please sign in to comment.