Commit 783e1d9a authored by Benedikt Heinrichs's avatar Benedikt Heinrichs
Browse files

Merge branch 'Topic/231-ORCiDIntegration' into 'Product/224-loginPage'

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

See merge request coscine/app/login!1
parents e9e3fef7 8496b8f5
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
:returnUrl="this.returnUrl" :returnUrl="this.returnUrl"
@back="loginBack" @back="loginBack"
@clickGetLoginForm="getLoginForm" @clickGetLoginForm="getLoginForm"
@clickGetORCiDForm="getORCiDForm"
/> />
</transition> </transition>
</div> </div>
...@@ -79,6 +80,14 @@ function getReturnUrl() { ...@@ -79,6 +80,14 @@ function getReturnUrl() {
return returnUrl; 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({ export default Vue.extend({
name: 'app', name: 'app',
components: { components: {
...@@ -90,6 +99,7 @@ export default Vue.extend({ ...@@ -90,6 +99,7 @@ export default Vue.extend({
coscineImage: scriptUrl + imagePath.substring(1), coscineImage: scriptUrl + imagePath.substring(1),
imageEnabled, imageEnabled,
returnUrl: getReturnUrl(), returnUrl: getReturnUrl(),
orcidUrl: getORCiDUrl(),
currentInputCard: 'LoginMain', currentInputCard: 'LoginMain',
}; };
}, },
...@@ -100,6 +110,9 @@ export default Vue.extend({ ...@@ -100,6 +110,9 @@ export default Vue.extend({
getLoginForm() { getLoginForm() {
this.currentInputCard = 'LoginForm'; this.currentInputCard = 'LoginForm';
}, },
getORCiDForm() {
window.location.href = this.orcidUrl;
},
}, },
}); });
</script> </script>
......
...@@ -2,13 +2,18 @@ ...@@ -2,13 +2,18 @@
<div> <div>
<h5 class="card-title">{{ $t('login_headline') }}</h5> <h5 class="card-title">{{ $t('login_headline') }}</h5>
<div class="row"> <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> <span>
<img alt="ORCID logo" id="orcid-id-logo" src="https://orcid.org/sites/default/files/images/orcid_24x24.png" width="25" height="25" /> <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>
<span> {{ $t('login_button_orcid') }}</span> <span> {{ $t('login_button_orcid') }}</span>
</button> </button>
</div> </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"> <div class="row">
<button class="btn btn-secondary w-100" disabled>{{ $t('login_button_without_account') }}</button> <button class="btn btn-secondary w-100" disabled>{{ $t('login_button_without_account') }}</button>
</div> </div>
...@@ -27,6 +32,9 @@ export default Vue.extend({ ...@@ -27,6 +32,9 @@ export default Vue.extend({
clickGetLoginForm() { clickGetLoginForm() {
this.$emit('clickGetLoginForm'); this.$emit('clickGetLoginForm');
}, },
clickGetORCiDForm() {
this.$emit('clickGetORCiDForm');
},
}, },
}); });
</script> </script>
......
...@@ -9,6 +9,7 @@ export default { ...@@ -9,6 +9,7 @@ export default {
login_headline: 'Login', login_headline: 'Login',
login_button_with_account: 'Login-Zugang', login_button_with_account: 'Login-Zugang',
login_button_orcid: 'Anmelden mit ORCID ID', login_button_orcid: 'Anmelden mit ORCID ID',
login_button_form: 'Anmelden mit User ID',
login_button_without_account: 'Weiter ohne Login', login_button_without_account: 'Weiter ohne Login',
signup: 'Anmelden', signup: 'Anmelden',
back: 'Zurück', back: 'Zurück',
......
...@@ -9,6 +9,7 @@ export default { ...@@ -9,6 +9,7 @@ export default {
login_headline: 'Login', login_headline: 'Login',
login_button_with_account: 'Login Access', login_button_with_account: 'Login Access',
login_button_orcid: 'Sign in with ORCID ID', login_button_orcid: 'Sign in with ORCID ID',
login_button_form: 'Sign in with a User ID',
login_button_without_account: 'Continue without Login', login_button_without_account: 'Continue without Login',
signup: 'signup', signup: 'signup',
back: 'Back', back: 'Back',
......
Supports Markdown
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