1import Modal from '/scripts/Modals/BasicModalMixin.js'; 2import SignedInPerson from '/scripts/MinistryDetails/SignedInPerson.js'; 3import NewPersonForm from '/scripts/MinistryDetails/NewPersonForm.js'; 4 5export default { 6 components: { 7 Modal, 8 SignedInPerson, 9 NewPersonForm, 10 }, 11 12 props: ['visible', 'ministry', 'person', 'isLoggedIn', 'logoutEndpoint'], 13 14 emits: ['close', 'register', 'sign-in'], 15 16 template: ` 17 <Modal 18 v-show="visible" 19 :visible="visible" 20 v-on:close="$emit('close')" 21 :class="['registration-popup', { 'logged-in': isLoggedIn }]" 22 > 23 <template v-slot:header> 24 <h3 class="title"> 25 {{ministry?.name}} 26 </h3> 27 <p class="subtitle"> 28 Dream Team Sign Up 29 </p> 30 </template> 31 32 <template v-slot:body> 33 <div class="body"> 34 <SignedInPerson 35 :person="person" 36 v-on:sign-out="onSignOutClick" 37 v-on:sign-up="onSignUpClick" 38 v-if="isLoggedIn" 39 /> 40 41 <NewPersonForm 42 v-on:sign-up="onSignUpClick" 43 v-on:sign-in="onSignInClick" 44 v-if="!isLoggedIn" 45 /> 46 </div> 47 </template> 48 49 <template v-slot:footer> 50 <p class="footer"> 51 Need Help? Email <a href="mailto:[email protected]">[email protected]</a> 52 </p> 53 </template> 54 </Modal> 55 `, 56 57 data() { 58 return { 59 debug: new URLSearchParams(window.location.search).has('debug'), 60 } 61 }, 62 63 computed: { 64 }, 65 66 watch: { 67 }, 68 69 methods: { 70 onSignOutClick() { 71 if (this.debug) { 72 console.log('[RegistrationPopup] Sign-out initiated'); 73 } 74 75 // Close the modal first 76 this.$emit('close'); 77 78 // Trigger the external logout form submission 79 setTimeout(() => { 80 const logoutButton = document.getElementById('logoutSubmitButton'); 81 if (logoutButton) { 82 if (this.debug) { 83 console.log('[RegistrationPopup] Triggering external logout button'); 84 } 85 86 // Set the return URL with full absolute URL including protocol 87 const logoutReturnUrl = document.getElementById('logoutReturnUrl'); 88 if (logoutReturnUrl) { 89 const fullUrl = `${window.location.protocol}//${window.location.host}${window.location.pathname}${window.location.search}`; 90 logoutReturnUrl.value = fullUrl; 91 92 if (this.debug) { 93 console.log('[RegistrationPopup] Setting logout return URL to:', fullUrl); 94 } 95 } 96 97 // Click the hidden logout button 98 logoutButton.click(); 99 } else { 100 if (this.debug) { 101 console.error('[RegistrationPopup] External logout button not found! Falling back to logoutEndpoint'); 102 } 103 // Fallback: redirect to homepage instead of logoutEndpoint 104 window.location.href = '/'; 105 } 106 }, 100); 107 }, 108 109 onSignUpClick(person) { 110 this.$emit('register', person); 111 }, 112 113 onSignInClick() { 114 if (this.debug) { 115 console.log('[RegistrationPopup] Sign-in initiated', { 116 ministryId: this.ministry?.id, 117 ministryName: this.ministry?.name 118 }); 119 } 120 121 // Store ministry context for after login 122 if (this.ministry?.id) { 123 sessionStorage.setItem('pendingMinistrySignup', 'true'); 124 sessionStorage.setItem('pendingMinistryId', this.ministry.id.toString()); 125 sessionStorage.setItem('pendingMinistryName', this.ministry.name || ''); 126 } 127 128 // Store flag to detect login redirect 129 sessionStorage.setItem('justLoggedIn', 'true'); 130 sessionStorage.setItem('reopenRegistrationPopup', 'true'); 131 132 // Close the modal 133 this.$emit('close'); 134 135 // Emit sign-in event to parent component to handle the actual login 136 this.$emit('sign-in'); 137 }, 138 }, 139};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.