def verify_email(token): try: email = confirm_verification_token(token) user = User.query.filter_by(email=email).first_or_404() print(user) if user.isVerified: return response_with(resp. INVALID_INPUT_422) else: user.isVerified = True db.session.add(user) db.session.commit() return response_with(resp.SUCCESS_200, value={'message': 'E-mail verified, you can proceed to login now.'}) except: return response_with(resp.SERVER_ERROR_404)
def verify_email(token): try: email = confirm_verification_token(token) except Exception as e: return response_with(resp.SERVER_ERROR_404) user = User.query.filter_by(email=email).first_or_404() if user.isVerified: return response_with(resp.INVALID_FIELD_NAME_SENT_422) else: user.isVerified = True db.session.add(user) db.session.commit() return response_with( resp.SUCCESS_200, value={ "message": "E-mail verified, you can proceed to login now." }, )