{"id":21351,"date":"2026-05-23T17:40:26","date_gmt":"2026-05-23T15:40:26","guid":{"rendered":"https:\/\/www.drugshortage.ch\/?page_id=21351"},"modified":"2026-06-19T21:31:34","modified_gmt":"2026-06-19T19:31:34","slug":"abo-bestaetigung","status":"publish","type":"page","link":"https:\/\/www.drugshortage.ch\/index.php\/abo-bestaetigung\/","title":{"rendered":"Abo Best\u00e4tigung"},"content":{"rendered":"\n<!-- Slug: abo-bestaetigung -->\n<!-- Diese Seite wird via Magic Link aufgerufen: \/abo-bestaetigung\/?token=XXX -->\n<!-- Optional: ?gtin=7680...&bez=ACETALGIN%20Supp \u2192 Medikament wird nach Login automatisch abonniert -->\n<style>\n  #best-outer { width:100%; max-width:600px; margin:0 auto; box-sizing:border-box; font-family:'Segoe UI',Arial,sans-serif; font-size:14px; color:#2d3748; }\n  .best-card { background:#fff; border:1px solid #e2e8f0; border-radius:12px; padding:32px; box-shadow:0 2px 8px rgba(0,0,0,.07); text-align:center; }\n  .best-spinner { width:40px; height:40px; border:4px solid #e2e8f0; border-top-color:#e53e3e; border-radius:50%; animation:bestspin .8s linear infinite; margin:20px auto; }\n  @keyframes bestspin { to { transform:rotate(360deg); } }\n  .best-success { color:#276749; }\n  .best-error   { color:#c53030; }\n  .best-info    { background:#f0fff4; border:1px solid #9ae6b4; border-radius:8px; padding:12px 16px; color:#276749; font-size:13px; margin:12px 0; text-align:left; }\n  .best-warn    { background:#fffbeb; border:1px solid #fbd38d; border-radius:8px; padding:12px 16px; color:#744210; font-size:13px; margin:12px 0; text-align:left; }\n  .best-btn { display:inline-block; margin-top:16px; padding:12px 24px; background:#e53e3e; color:#fff; border-radius:8px; text-decoration:none; font-weight:600; }\n  .best-btn-grey { background:#718096; }\n<\/style>\n\n<div id=\"best-outer\">\n  <div class=\"best-card\">\n    <div id=\"best-loading\"><div class=\"best-spinner\"><\/div><p>Link wird gepr\u00fcft\u2026<\/p><\/div>\n    <div id=\"best-inhalt\" style=\"display:none;\"><\/div>\n  <\/div>\n<\/div>\n\n<script>\nconst BEST_BASE    = \"https:\/\/www.drugshortage.ch\";\nconst BEST_API_REG = BEST_BASE + \"\/api\/api_abo_registrierung.php\";\nconst BEST_API_ABO = BEST_BASE + \"\/api\/api_abo_verwaltung.php\";\n\ndocument.addEventListener('DOMContentLoaded', async function() {\n  const params = new URLSearchParams(window.location.search);\n  const token  = params.get('token') || '';\n  const gtin   = params.get('gtin')  || '';\n  const bez    = params.get('bez')   || '';\n\n  if (!token) {\n    zeige('error', '&#x274c; Kein Token gefunden.',\n      '<a href=\"' + BEST_BASE + '\/index.php\/abo-registrierung\/\" class=\"best-btn best-btn-grey\">Neuen Link anfordern<\/a>');\n    return;\n  }\n\n  try {\n    \/\/ 1. Token best\u00e4tigen\n    const res = await fetch(BEST_API_REG + \"?action=bestaetigen&token=\" + encodeURIComponent(token));\n    const d   = await res.json();\n\n    if (!d.ok) {\n      zeige('error', '&#x274c; ' + (d.message || 'Ung\u00fcltiger Link.'),\n        '<a href=\"' + BEST_BASE + '\/index.php\/abo-registrierung\/\" class=\"best-btn best-btn-grey\">Neuen Link anfordern<\/a>');\n      return;\n    }\n\n    \/\/ 2. Session speichern\n    localStorage.setItem('abo_token', d.token);\n    localStorage.setItem('abo_email', d.email);\n\n    \/\/ 3. GTIN automatisch abonnieren falls vorhanden\n    let aboHinweis = '';\n    if (gtin) {\n      try {\n        const aboRes = await fetch(BEST_API_ABO + '?action=hinzufuegen&token=' + encodeURIComponent(d.token), {\n          method: 'POST',\n          headers: {'Content-Type': 'application\/json'},\n          body: JSON.stringify({gtins: [{gtin: gtin, bezeichnung: bez}]})\n        });\n        const aboD = await aboRes.json();\n        if (aboD.ok && aboD.hinzugefuegt > 0) {\n          aboHinweis = '<div class=\"best-info\">&#x2705; <strong>' + (bez || gtin) + '<\/strong> wurde Ihren Abonnements hinzugef\u00fcgt.<\/div>';\n        } else if (aboD.ok && aboD.hinzugefuegt === 0) {\n          \/\/ Bereits abonniert (Duplikat)\n          aboHinweis = '<div class=\"best-info\">&#x2139;&#xfe0f; <strong>' + (bez || gtin) + '<\/strong> ist bereits in Ihren Abonnements.<\/div>';\n        } else {\n          aboHinweis = '<div class=\"best-warn\">&#x26a0;&#xfe0f; ' + (aboD.message || 'Medikament konnte nicht hinzugef\u00fcgt werden.') + '<\/div>';\n        }\n      } catch(aboErr) {\n        aboHinweis = '<div class=\"best-warn\">&#x26a0;&#xfe0f; Medikament konnte nicht automatisch hinzugef\u00fcgt werden. Bitte manuell in der Verwaltung eintragen.<\/div>';\n      }\n    }\n\n    \/\/ 4. Erfolgsseite anzeigen\n    zeige('success', '&#x2705; Erfolgreich eingeloggt!',\n      '<p>Sie sind als <strong>' + d.email + '<\/strong> eingeloggt.<\/p>' +\n      aboHinweis +\n      '<a href=\"' + BEST_BASE + '\/index.php\/abo-verwaltung\/\" class=\"best-btn\">Zu Ihren Abonnements \u2192<\/a>');\n\n  } catch(err) {\n    zeige('error', '&#x274c; Verbindungsfehler: ' + err, '');\n  }\n});\n\nfunction zeige(typ, titel, inhalt) {\n  document.getElementById('best-loading').style.display = 'none';\n  const el = document.getElementById('best-inhalt');\n  el.innerHTML = '<h2 class=\"best-' + typ + '\">' + titel + '<\/h2>' + inhalt;\n  el.style.display = 'block';\n}\n<\/script>\n\n","protected":false},"excerpt":{"rendered":"<p>Link wird gepr\u00fcft\u2026<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_robots_index":"","_seopress_robots_follow":"","_seopress_robots_imageindex":"","_seopress_robots_snippet":"","_seopress_robots_primary_cat":"","_seopress_robots_breadcrumbs":"","_seopress_robots_freeze_modified_date":"","_seopress_robots_custom_modified_date":"","_seopress_robots_canonical":"","_seopress_social_fb_title":"","_seopress_social_fb_desc":"","_seopress_social_fb_img":"","_seopress_social_fb_img_attachment_id":0,"_seopress_social_fb_img_width":0,"_seopress_social_fb_img_height":0,"_seopress_social_twitter_title":"","_seopress_social_twitter_desc":"","_seopress_social_twitter_img":"","_seopress_social_twitter_img_attachment_id":0,"_seopress_social_twitter_img_width":0,"_seopress_social_twitter_img_height":0,"_seopress_redirections_value":"","_seopress_redirections_enabled":"","_seopress_redirections_enabled_regex":"","_seopress_redirections_logged_status":"","_seopress_redirections_param":"","_seopress_redirections_type":0,"_seopress_analysis_target_kw":"","_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","footnotes":"","_members_access_role":[],"_members_access_error":""},"class_list":["post-21351","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.drugshortage.ch\/index.php\/wp-json\/wp\/v2\/pages\/21351","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.drugshortage.ch\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.drugshortage.ch\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.drugshortage.ch\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.drugshortage.ch\/index.php\/wp-json\/wp\/v2\/comments?post=21351"}],"version-history":[{"count":7,"href":"https:\/\/www.drugshortage.ch\/index.php\/wp-json\/wp\/v2\/pages\/21351\/revisions"}],"predecessor-version":[{"id":21837,"href":"https:\/\/www.drugshortage.ch\/index.php\/wp-json\/wp\/v2\/pages\/21351\/revisions\/21837"}],"wp:attachment":[{"href":"https:\/\/www.drugshortage.ch\/index.php\/wp-json\/wp\/v2\/media?parent=21351"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}