2018-02-21 19:11:24 +01:00
|
|
|
<template>
|
2018-02-21 21:05:19 +01:00
|
|
|
<div class="welcome">
|
2018-04-27 12:12:15 +02:00
|
|
|
<div>
|
2018-06-14 00:22:50 +02:00
|
|
|
<img :src="$store.state.device.darkmode ? 'assets/title.dark.svg' : 'assets/title.light.svg'" alt="Misskey">
|
2018-06-14 02:51:55 +02:00
|
|
|
<p class="host">{{ host }}</p>
|
|
|
|
<div class="about">
|
|
|
|
<h2>{{ name || 'unidentified' }}</h2>
|
|
|
|
<p v-html="description || '%i18n:common.about%'"></p>
|
|
|
|
<router-link class="signup" to="/signup">新規登録</router-link>
|
|
|
|
</div>
|
|
|
|
<div class="login">
|
2018-06-14 00:22:50 +02:00
|
|
|
<form @submit.prevent="onSubmit">
|
2018-06-14 07:52:37 +02:00
|
|
|
<ui-input v-model="username" type="text" pattern="^[a-zA-Z0-9_]+$" autofocus required @change="onUsernameChange">
|
2018-06-14 00:22:50 +02:00
|
|
|
<span>ユーザー名</span>
|
|
|
|
<span slot="prefix">@</span>
|
|
|
|
<span slot="suffix">@{{ host }}</span>
|
|
|
|
</ui-input>
|
2018-06-14 07:52:37 +02:00
|
|
|
<ui-input v-model="password" type="password" required>
|
2018-06-14 00:22:50 +02:00
|
|
|
<span>パスワード</span>
|
|
|
|
<span slot="prefix">%fa:lock%</span>
|
|
|
|
</ui-input>
|
2018-06-14 07:52:37 +02:00
|
|
|
<ui-input v-if="user && user.twoFactorEnabled" v-model="token" type="number" required/>
|
2018-06-14 00:22:50 +02:00
|
|
|
<ui-button type="submit" :disabled="signing">{{ signing ? 'ログインしています' : 'ログイン' }}</ui-button>
|
|
|
|
</form>
|
2018-02-21 21:05:19 +01:00
|
|
|
<div>
|
2018-06-14 00:22:50 +02:00
|
|
|
<a :href="`${apiUrl}/signin/twitter`">Twitterでログイン</a>
|
2018-02-21 21:05:19 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2018-04-27 12:12:15 +02:00
|
|
|
<footer>
|
|
|
|
<small>{{ copyright }}</small>
|
|
|
|
</footer>
|
2018-02-21 21:05:19 +01:00
|
|
|
</div>
|
2018-02-21 19:11:24 +01:00
|
|
|
</div>
|
|
|
|
</template>
|
2018-02-21 21:05:19 +01:00
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
2018-06-13 23:29:01 +02:00
|
|
|
import { apiUrl, copyright, host } from '../../../config';
|
2018-02-21 21:05:19 +01:00
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
signing: false,
|
|
|
|
user: null,
|
|
|
|
username: '',
|
|
|
|
password: '',
|
|
|
|
token: '',
|
2018-03-16 19:33:36 +01:00
|
|
|
apiUrl,
|
2018-03-17 15:01:17 +01:00
|
|
|
copyright,
|
2018-06-13 23:29:01 +02:00
|
|
|
users: [],
|
|
|
|
host
|
2018-02-21 21:05:19 +01:00
|
|
|
};
|
|
|
|
},
|
|
|
|
mounted() {
|
2018-03-17 15:01:17 +01:00
|
|
|
(this as any).api('users', {
|
|
|
|
sort: '+follower',
|
|
|
|
limit: 20
|
|
|
|
}).then(users => {
|
|
|
|
this.users = users;
|
|
|
|
});
|
2018-02-21 21:05:19 +01:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
onUsernameChange() {
|
|
|
|
(this as any).api('users/show', {
|
|
|
|
username: this.username
|
|
|
|
}).then(user => {
|
|
|
|
this.user = user;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
onSubmit() {
|
|
|
|
this.signing = true;
|
|
|
|
|
|
|
|
(this as any).api('signin', {
|
|
|
|
username: this.username,
|
|
|
|
password: this.password,
|
2018-04-07 20:58:11 +02:00
|
|
|
token: this.user && this.user.twoFactorEnabled ? this.token : undefined
|
2018-02-21 21:05:19 +01:00
|
|
|
}).then(() => {
|
|
|
|
location.reload();
|
|
|
|
}).catch(() => {
|
|
|
|
alert('something happened');
|
|
|
|
this.signing = false;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
|
|
|
.welcome
|
2018-06-14 02:51:55 +02:00
|
|
|
text-align center
|
|
|
|
//background #fff
|
2018-02-21 21:05:19 +01:00
|
|
|
|
2018-04-27 12:12:15 +02:00
|
|
|
> div
|
2018-06-14 02:51:55 +02:00
|
|
|
padding 32px
|
2018-04-27 12:12:15 +02:00
|
|
|
margin 0 auto
|
|
|
|
max-width 500px
|
2018-02-21 21:05:19 +01:00
|
|
|
|
2018-06-14 00:22:50 +02:00
|
|
|
> img
|
|
|
|
display block
|
|
|
|
max-width 200px
|
|
|
|
margin 0 auto
|
2018-04-27 12:12:15 +02:00
|
|
|
|
2018-06-14 02:51:55 +02:00
|
|
|
> .host
|
|
|
|
display block
|
|
|
|
text-align center
|
|
|
|
padding 6px 12px
|
|
|
|
line-height 32px
|
|
|
|
font-weight bold
|
|
|
|
color #333
|
|
|
|
background rgba(#000, 0.035)
|
|
|
|
border-radius 6px
|
|
|
|
|
|
|
|
> .about
|
|
|
|
margin-top 16px
|
|
|
|
padding 16px
|
2018-06-14 07:52:37 +02:00
|
|
|
color #555
|
2018-06-14 02:51:55 +02:00
|
|
|
background #fff
|
|
|
|
border-radius 6px
|
|
|
|
|
|
|
|
> h2
|
|
|
|
margin 0
|
|
|
|
|
|
|
|
> p
|
|
|
|
margin 8px
|
|
|
|
|
|
|
|
> .signup
|
|
|
|
font-weight bold
|
|
|
|
|
|
|
|
> .login
|
|
|
|
margin 16px 0
|
2018-04-27 12:12:15 +02:00
|
|
|
|
2018-06-14 00:22:50 +02:00
|
|
|
> form
|
2018-02-21 21:05:19 +01:00
|
|
|
|
2018-06-14 00:22:50 +02:00
|
|
|
button
|
|
|
|
display block
|
|
|
|
width 100%
|
|
|
|
padding 10px
|
|
|
|
margin 0
|
|
|
|
color #333
|
|
|
|
font-size 1em
|
2018-04-27 12:12:15 +02:00
|
|
|
text-align center
|
2018-06-14 00:22:50 +02:00
|
|
|
text-decoration none
|
|
|
|
text-shadow 0 1px 0 rgba(255, 255, 255, 0.9)
|
|
|
|
background-image linear-gradient(#fafafa, #eaeaea)
|
|
|
|
border 1px solid #ddd
|
|
|
|
border-bottom-color #cecece
|
|
|
|
border-radius 4px
|
|
|
|
|
|
|
|
&:active
|
|
|
|
background-color #767676
|
|
|
|
background-image none
|
|
|
|
border-color #444
|
|
|
|
box-shadow 0 1px 3px rgba(#000, 0.075), inset 0 0 5px rgba(#000, 0.2)
|
2018-03-16 19:33:36 +01:00
|
|
|
|
2018-04-27 12:12:15 +02:00
|
|
|
> footer
|
|
|
|
text-align center
|
2018-06-14 02:51:55 +02:00
|
|
|
color #444
|
2018-03-17 15:01:17 +01:00
|
|
|
|
2018-04-27 12:12:15 +02:00
|
|
|
> small
|
|
|
|
display block
|
|
|
|
margin 16px 0 0 0
|
|
|
|
opacity 0.7
|
2018-03-16 19:33:36 +01:00
|
|
|
|
2018-02-21 21:05:19 +01:00
|
|
|
</style>
|