def verify_email(payload): try: user_id = get_serializer().loads(payload) except BadSignature: abort(404) user = User.query.get_or_404(user_id) if user != g.user: abort(403) user.verified = True db.session.commit() flash('E-mail verification successful - thank you!') return redirect(url_for('index'))
def get_verification_link(self): payload = get_serializer().dumps(self.user_id) return url_for('verify_email', payload=payload, _external=True)