Skip to content
Snippets Groups Projects
Select Git revision
  • 17cf125622a84ca97d5bc273341772efedd9583c
  • master default protected
  • gitkeep
  • dev protected
  • Issue/2218-updateLinksToDocumentationPage
  • Issue/2215-releaseNewsBeGone
  • czepiel-devops
  • Issue/1756-maintenanceBannerDeployment
  • Issue/1869-LoginForTUDO
  • Issue/1941-loginPageText
  • Sprint/2022-01
  • Hotfix/1911-fixFormatting
  • Sprint/2021-2022
  • Issue/912-rearrangeHeader
  • Issue/1872-addingTUDaToLoginPage
  • Sprint/2021-22
  • Issue/1743-changedLink
  • Hotfix/64-releaseUDE
  • Sprint/2021-19
  • Product/1629-onboardingOtherUniversities
  • Topic/1711-extendResourceTypeConfiguration
  • v1.23.0
  • v1.22.0
  • v1.21.1
  • v1.21.0
  • v1.20.2
  • v1.20.1
  • v1.20.0
  • v1.19.0
  • v1.18.1
  • v1.18.0
  • v1.17.0
  • v1.16.0
  • v1.15.0
  • v1.14.1
  • v1.14.0
  • v1.13.0
  • v1.12.0
  • v1.11.1
  • v1.11.0
  • v1.10.0
41 results

LoginMain.vue

Blame
  • Theresia Rupprecht's avatar
    Theresia Rupprecht authored and Hanna Führ committed
    10202566
    History
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    LoginMain.vue 2.11 KiB
    <template>
      <div>
        <h5 class="card-title">{{ $t('login_headline') }}</h5>
        <div v-if="showInstitutes">
          <login-institute @closeInstituteSelection="changeInstitutesVisibility"></login-institute>
        </div>
        <div v-else>
          <div>
            <button class="btn btn-primary w-100" name="getORCiDForm" @click.prevent="clickGetORCiDForm">
              <span>
                <img alt="ORCID logo" id="orcid-id-logo" src='@/assets/orcid_24x24.png'  width="23" height="20" />
              </span>
              <span>  {{ $t('login_button_orcid') }}</span>
            </button>
          </div>
          <div v-if="wasPreviouslyAuthenticated">
            <b-button class="w-100" variant="primary" @click="loginInstitutePage">{{ storedValue.DisplayName }}</b-button>
            <input type="hidden" name="wa" value="wsignin1.0" />
          </div>
          <div>
            <b-button class="w-100" variant="primary" @click="changeInstitutesVisibility">{{ $t('other_institutes') }}</b-button>
          </div>
        </div>
      </div>
    </template>
    
    <script lang='ts'>
    import Vue from 'vue';
    import LoginInstitute from './LoginInstitute.vue';
    import * as linkUtil from '@/util/linkUtil';
    
    export default Vue.extend({
      name: 'LoginMain',
      components: {
        LoginInstitute,
      },
      data() {
        return {
          wasPreviouslyAuthenticated: false,
          showInstitutes: false,
          storedValue: null as Object | null,
        };
      },
      props: {
        returnUrl: String,
      },
      created() {
        const storedValue = localStorage.getItem('coscine.login.storedData');
        if (storedValue !== null) {
          this.storedValue = JSON.parse(storedValue);
          this.wasPreviouslyAuthenticated = true;
        }
      },
      methods: {
        loginInstitutePage() {
          const entityId = (this.storedValue as any).entityID;
          if (entityId !== null) {
            window.location.href = linkUtil.getReturnUrl('Shibboleth', entityId);
          }
        },
        clickGetORCiDForm() {
          this.$emit('clickGetORCiDForm');
        },
        changeInstitutesVisibility() {
          this.showInstitutes = !this.showInstitutes;
        },
      },
    });
    </script>
    
    <style scoped>
    .btn {
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    </style>