 
 UserSchema.post 'init', (doc) ->
   doc.startingEmails = _.cloneDeep(doc.get('emails'))
-  
+
 UserSchema.statics.hashPassword = (password) ->
   password = password.toLowerCase()
   shasum = crypto.createHash('sha512')

  @saveActiveUser 'register'

UserSchema.methods.isPremium = ->
  return false unless stripe = @get('stripe')
  return true if stripe.subscriptionID
  return true if stripe.free is true
  return true if _.isString(stripe.free) and new Date() < new Date(stripe.free)
  return false

UserSchema.statics.saveActiveUser = (id, event, done=null) ->

  newSubs[newName].enabled = enabled
  @set('emails', newSubs)
  @newsSubsChanged = true if newName in mail.NEWS_GROUPS

UserSchema.methods.gems = ->
  gemsEarned = @get('earned')?.gems ? 0
  gemsPurchased = @get('purchased')?.gems ? 0
