Commit 8496b8f5 authored by Benedikt Heinrichs's avatar Benedikt Heinrichs
Browse files

Update: ORCiD Button used (coscine/issues#231)

parent e9e3fef7
......@@ -33,6 +33,7 @@
:returnUrl="this.returnUrl"
@back="loginBack"
@clickGetLoginForm="getLoginForm"
@clickGetORCiDForm="getORCiDForm"
/>
</transition>
</div>
......@@ -79,6 +80,14 @@ function getReturnUrl() {
return returnUrl;
}
function getORCiDUrl() {
const hookupElement = document.getElementById('loginpage');
const orcidUrlString =
(hookupElement != null ? hookupElement.getAttribute('orcidUrl') : '') as string;
const orcidUrl = encodeURI(orcidUrlString);
return orcidUrl;
}
export default Vue.extend({
name: 'app',
components: {
......@@ -90,6 +99,7 @@ export default Vue.extend({
coscineImage: scriptUrl + imagePath.substring(1),
imageEnabled,
returnUrl: getReturnUrl(),
orcidUrl: getORCiDUrl(),
currentInputCard: 'LoginMain',
};
},
......@@ -100,6 +110,9 @@ export default Vue.extend({
getLoginForm() {
this.currentInputCard = 'LoginForm';
},
getORCiDForm() {
window.location.href = this.orcidUrl;
},
},
});
</script>
......
......@@ -2,13 +2,18 @@
<div>
<h5 class="card-title">{{ $t('login_headline') }}</h5>
<div class="row">
<button class="btn btn-primary w-100" name="getLoginForm" @click.prevent="clickGetLoginForm">
<button class="btn btn-primary w-100" name="getORCiDForm" @click.prevent="clickGetORCiDForm">
<span>
<img alt="ORCID logo" id="orcid-id-logo" src="https://orcid.org/sites/default/files/images/orcid_24x24.png" width="25" height="25" />
</span>
<span> {{ $t('login_button_orcid') }}</span>
</button>
</div>
<div class="row">
<button class="btn btn-primary w-100" name="getLoginForm" @click.prevent="clickGetLoginForm">
{{ $t('login_button_form') }}
</button>
</div>
<div class="row">
<button class="btn btn-secondary w-100" disabled>{{ $t('login_button_without_account') }}</button>
</div>
......@@ -27,6 +32,9 @@ export default Vue.extend({
clickGetLoginForm() {
this.$emit('clickGetLoginForm');
},
clickGetORCiDForm() {
this.$emit('clickGetORCiDForm');
},
},
});
</script>
......
......@@ -9,6 +9,7 @@ export default {
login_headline: 'Login',
login_button_with_account: 'Login-Zugang',
login_button_orcid: 'Anmelden mit ORCID ID',
login_button_form: 'Anmelden mit User ID',
login_button_without_account: 'Weiter ohne Login',
signup: 'Anmelden',
back: 'Zurück',
......
......@@ -9,6 +9,7 @@ export default {
login_headline: 'Login',
login_button_with_account: 'Login Access',
login_button_orcid: 'Sign in with ORCID ID',
login_button_form: 'Sign in with a User ID',
login_button_without_account: 'Continue without Login',
signup: 'signup',
back: 'Back',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment