示例#1
0
    def GET(self, cart_id):
        """Display the badges associated with a Cart ID"""
        try:
            bson.objectid.ObjectId(cart_id)
        except bson.errors.InvalidId:
            return render.base(render.validate(None, ("bad", "Invalid ObjectId")), "Pickup", True)

        return render.base(render.pickup(view.badgeListing(cart_id)), "Pickup", True)
示例#2
0
    def GET(self, cart_id, hash):
        """Validate an email and forward to the pickup page"""
        try:
            bson.objectid.ObjectId(cart_id)
        except bson.errors.InvalidId:
            return render.base(render.validate(None, ("bad", "Invalid ObjectId")), "Confirmation", True)

        cart = db.getCart(cart_id)
        if not cart:
            return render.base("""<h2>Ce courriel est invalide</h2>""", "Confirmation", True)

        vEmail = hashlib.sha1()
        vEmail.update(cart["email"])
        vEmail.update(config.salt)
        if vEmail.hexdigest() == hash:
            db.cartValidEmail(cart_id)
            raise web.seeother(config.make_url("/pickup/%s" % (cart_id, )))
        else:
           return  render.base("""<h2>Ce courriel est invalide</h2>""", "Confirmation", True)