Hide unused login method (#3285)

This commit is contained in:
MeiMei 2018-11-17 02:13:01 +09:00 committed by syuilo
parent 01964f3926
commit db657c2a62
2 changed files with 14 additions and 7 deletions

View file

@ -12,9 +12,9 @@
</ui-input> </ui-input>
<ui-input v-if="user && user.twoFactorEnabled" v-model="token" type="number" required styl="fill"/> <ui-input v-if="user && user.twoFactorEnabled" v-model="token" type="number" required styl="fill"/>
<ui-button type="submit" :disabled="signing">{{ signing ? $t('signing-in') : $t('signin') }}</ui-button> <ui-button type="submit" :disabled="signing">{{ signing ? $t('signing-in') : $t('signin') }}</ui-button>
<p style="margin: 8px 0;"><a :href="`${apiUrl}/signin/twitter`">{{ $t('signin-with-twitter') }}</a></p> <p v-if="meta && meta.enableTwitterIntegration" style="margin: 8px 0;"><a :href="`${apiUrl}/signin/twitter`">{{ $t('signin-with-twitter') }}</a></p>
<p style="margin: 8px 0;"><a :href="`${apiUrl}/signin/github`">{{ $t('signin-with-github') }}</a></p> <p v-if="meta && meta.enableGithubIntegration" style="margin: 8px 0;"><a :href="`${apiUrl}/signin/github`">{{ $t('signin-with-github') }}</a></p>
<p style="margin: 8px 0;"><a :href="`${apiUrl}/signin/discord`">{{ $t('signin-with-discord') /* TODO: Make these layouts better */ }}</a></p> <p v-if="meta && meta.enableDiscordIntegration" style="margin: 8px 0;"><a :href="`${apiUrl}/signin/discord`">{{ $t('signin-with-discord') /* TODO: Make these layouts better */ }}</a></p>
</form> </form>
</template> </template>
@ -41,9 +41,15 @@ export default Vue.extend({
password: '', password: '',
token: '', token: '',
apiUrl, apiUrl,
host: toUnicode(host) host: toUnicode(host),
meta: null
}; };
}, },
created() {
this.$root.getMeta().then(meta => {
this.meta = meta;
});
},
methods: { methods: {
onUsernameChange() { onUsernameChange() {
this.$root.api('users/show', { this.$root.api('users/show', {

View file

@ -68,6 +68,10 @@ export default define(meta, (ps, me) => new Promise(async (res, rej) => {
maxNoteTextLength: instance.maxNoteTextLength, maxNoteTextLength: instance.maxNoteTextLength,
emojis: emojis, emojis: emojis,
enableTwitterIntegration: instance.enableTwitterIntegration,
enableGithubIntegration: instance.enableGithubIntegration,
enableDiscordIntegration: instance.enableDiscordIntegration,
}; };
if (ps.detail) { if (ps.detail) {
@ -89,13 +93,10 @@ export default define(meta, (ps, me) => new Promise(async (res, rej) => {
response.hidedTags = instance.hidedTags; response.hidedTags = instance.hidedTags;
response.recaptchaSecretKey = instance.recaptchaSecretKey; response.recaptchaSecretKey = instance.recaptchaSecretKey;
response.proxyAccount = instance.proxyAccount; response.proxyAccount = instance.proxyAccount;
response.enableTwitterIntegration = instance.enableTwitterIntegration;
response.twitterConsumerKey = instance.twitterConsumerKey; response.twitterConsumerKey = instance.twitterConsumerKey;
response.twitterConsumerSecret = instance.twitterConsumerSecret; response.twitterConsumerSecret = instance.twitterConsumerSecret;
response.enableGithubIntegration = instance.enableGithubIntegration;
response.githubClientId = instance.githubClientId; response.githubClientId = instance.githubClientId;
response.githubClientSecret = instance.githubClientSecret; response.githubClientSecret = instance.githubClientSecret;
response.enableDiscordIntegration = instance.enableDiscordIntegration;
response.discordClientId = instance.discordClientId; response.discordClientId = instance.discordClientId;
response.discordClientSecret = instance.discordClientSecret; response.discordClientSecret = instance.discordClientSecret;
} }