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 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>
<p 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 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.enableTwitterIntegration" style="margin: 8px 0;"><a :href="`${apiUrl}/signin/twitter`">{{ $t('signin-with-twitter') }}</a></p>
<p v-if="meta && meta.enableGithubIntegration" style="margin: 8px 0;"><a :href="`${apiUrl}/signin/github`">{{ $t('signin-with-github') }}</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>
</template>
@ -41,9 +41,15 @@ export default Vue.extend({
password: '',
token: '',
apiUrl,
host: toUnicode(host)
host: toUnicode(host),
meta: null
};
},
created() {
this.$root.getMeta().then(meta => {
this.meta = meta;
});
},
methods: {
onUsernameChange() {
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,
emojis: emojis,
enableTwitterIntegration: instance.enableTwitterIntegration,
enableGithubIntegration: instance.enableGithubIntegration,
enableDiscordIntegration: instance.enableDiscordIntegration,
};
if (ps.detail) {
@ -89,13 +93,10 @@ export default define(meta, (ps, me) => new Promise(async (res, rej) => {
response.hidedTags = instance.hidedTags;
response.recaptchaSecretKey = instance.recaptchaSecretKey;
response.proxyAccount = instance.proxyAccount;
response.enableTwitterIntegration = instance.enableTwitterIntegration;
response.twitterConsumerKey = instance.twitterConsumerKey;
response.twitterConsumerSecret = instance.twitterConsumerSecret;
response.enableGithubIntegration = instance.enableGithubIntegration;
response.githubClientId = instance.githubClientId;
response.githubClientSecret = instance.githubClientSecret;
response.enableDiscordIntegration = instance.enableDiscordIntegration;
response.discordClientId = instance.discordClientId;
response.discordClientSecret = instance.discordClientSecret;
}