Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def after_save
- # Assuming that this method is called on record creation and update
- # First, let's see if there's an existing record we need to update
- sub = LcrSubscriber.find_by_username(self.login) || LcrSubscriber.new
- sub.username = self.login
- sub.domain = ENV['SIP_DOMAIN']
- sub.password = ENV['DEFAULT_PASSWORD']
- sub.ha1 = Digest::MD5.hexdigest("#{sub.username}:#{sub.domain}:#{sub.password}")
- sub.ha1b = Digest::MD5.hexdigest("#{sub.username}@#{sub.domain}:#{sub.domain}:#{sub.password}")
- sub.save!
- end
Add Comment
Please, Sign In to add comment