             callback err
           else
             callback new KodingError 'The token has expired.'
-      else callback null, yes
+      else
+        JUser = require './user'
+        JUser.one {email:certificate.email}, (err, user)->
+          return callback new Error "Error occured. Please try again." if err
+          user.confirmEmail (err)->
+            return callback new Error "Error occured. Please try again." if err
+            callback null, yes
 
   @invalidate =(query, callback)->
     query.status = 'active'


    {host, protocol} = require '../config.email'
    messageOptions =
      url : "#{protocol}//#{host}/Recover/#{encodeURIComponent token}"

    JUser.one {email}, (err, user)=>
      if err

                    callback err
                  else
                    JPasswordRecovery.invalidate {username}, (err)->
                      return callback new Error "Error occured. Please try again." if err
                      user.confirmEmail (err)->
                        return callback new Error "Error occured. Please try again." if err
                        callback err, unless err then username

  expire:(callback)-> @update {$set: status: 'expired'}, callback
  redeem:(callback)-> @update {$set: status: 'redeemed'}, callback
