def confirm(cls, nonce): if ':' in nonce: # form created in the dashboard # nonce is another hash and the # hashid comes in the request. nonce, hashid = nonce.split(':') form = cls.get_with_hashid(hashid) if HASH(form.email, str(form.id)) == nonce: pass else: form = None else: # normal form, nonce is HASH(email, host) form = cls.query.filter_by(hash=nonce).first() if form: form.confirmed = True DB.session.add(form) DB.session.commit() stored_data = fetch_first_submission(nonce) if stored_data: form.send(stored_data, stored_data.keys(), form.host) return form