1
0
mirror of https://github.com/MisskeyIO/misskey synced 2024-12-16 15:48:19 +09:00
This commit is contained in:
syuilo 2018-02-22 01:25:57 +09:00
parent a77ac7e651
commit 3d4fccef45
8 changed files with 78 additions and 66 deletions

View File

@ -17,6 +17,7 @@ import ellipsis from './ellipsis.vue';
import messaging from './messaging.vue'; import messaging from './messaging.vue';
import messagingRoom from './messaging-room.vue'; import messagingRoom from './messaging-room.vue';
import urlPreview from './url-preview.vue'; import urlPreview from './url-preview.vue';
import twitterSetting from './twitter-setting.vue';
Vue.component('mk-signin', signin); Vue.component('mk-signin', signin);
Vue.component('mk-signup', signup); Vue.component('mk-signup', signup);
@ -35,3 +36,4 @@ Vue.component('mk-ellipsis', ellipsis);
Vue.component('mk-messaging', messaging); Vue.component('mk-messaging', messaging);
Vue.component('mk-messaging-room', messagingRoom); Vue.component('mk-messaging-room', messagingRoom);
Vue.component('mk-url-preview', urlPreview); Vue.component('mk-url-preview', urlPreview);
Vue.component('mk-twitter-setting', twitterSetting);

View File

@ -1,11 +0,0 @@
import * as riot from 'riot';
export default (title, onOk, onCancel) => {
const dialog = document.body.appendChild(document.createElement('mk-input-dialog'));
return (riot as any).mount(dialog, {
title: title,
type: 'password',
onOk: onOk,
onCancel: onCancel
});
};

View File

@ -1,37 +0,0 @@
<template>
<div>
<button @click="reset" class="ui primary">%i18n:desktop.tags.mk-password-setting.reset%</button>
</div>
</template>
<script lang="ts">
import Vue from 'vue';
import passwordDialog from '../../scripts/password-dialog';
import dialog from '../../scripts/dialog';
import notify from '../../scripts/notify';
export default Vue.extend({
methods: {
reset() {
passwordDialog('%i18n:desktop.tags.mk-password-setting.enter-current-password%', currentPassword => {
passwordDialog('%i18n:desktop.tags.mk-password-setting.enter-new-password%', newPassword => {
passwordDialog('%i18n:desktop.tags.mk-password-setting.enter-new-password-again%', newPassword2 => {
if (newPassword !== newPassword2) {
dialog(null, '%i18n:desktop.tags.mk-password-setting.not-match%', [{
text: 'OK'
}]);
return;
}
(this as any).api('i/change_password', {
current_password: currentPassword,
new_password: newPassword
}).then(() => {
notify('%i18n:desktop.tags.mk-password-setting.changed%');
});
});
});
});
}
}
});
</script>

View File

@ -1,16 +1,16 @@
<template> <template>
<div class="mk-2fa-setting"> <div class="2fa">
<p>%i18n:desktop.tags.mk-2fa-setting.intro%<a href="%i18n:desktop.tags.mk-2fa-setting.url%" target="_blank">%i18n:desktop.tags.mk-2fa-setting.detail%</a></p> <p>%i18n:desktop.tags.mk-2fa-setting.intro%<a href="%i18n:desktop.tags.mk-2fa-setting.url%" target="_blank">%i18n:desktop.tags.mk-2fa-setting.detail%</a></p>
<div class="ui info warn"><p>%fa:exclamation-triangle%%i18n:desktop.tags.mk-2fa-setting.caution%</p></div> <div class="ui info warn"><p>%fa:exclamation-triangle%%i18n:desktop.tags.mk-2fa-setting.caution%</p></div>
<p v-if="!data && !I.two_factor_enabled"><button @click="register" class="ui primary">%i18n:desktop.tags.mk-2fa-setting.register%</button></p> <p v-if="!data && !os.i.two_factor_enabled"><button @click="register" class="ui primary">%i18n:desktop.tags.mk-2fa-setting.register%</button></p>
<template v-if="I.two_factor_enabled"> <template v-if="os.i.two_factor_enabled">
<p>%i18n:desktop.tags.mk-2fa-setting.already-registered%</p> <p>%i18n:desktop.tags.mk-2fa-setting.already-registered%</p>
<button @click="unregister" class="ui">%i18n:desktop.tags.mk-2fa-setting.unregister%</button> <button @click="unregister" class="ui">%i18n:desktop.tags.mk-2fa-setting.unregister%</button>
</template> </template>
<div v-if="data"> <div v-if="data">
<ol> <ol>
<li>%i18n:desktop.tags.mk-2fa-setting.authenticator% <a href="https://support.google.com/accounts/answer/1066447" target="_blank">%i18n:desktop.tags.mk-2fa-setting.howtoinstall%</a></li> <li>%i18n:desktop.tags.mk-2fa-setting.authenticator% <a href="https://support.google.com/accounts/answer/1066447" target="_blank">%i18n:desktop.tags.mk-2fa-setting.howtoinstall%</a></li>
<li>%i18n:desktop.tags.mk-2fa-setting.scan%<br><img src={ data.qr }></li> <li>%i18n:desktop.tags.mk-2fa-setting.scan%<br><img :src="data.qr"></li>
<li>%i18n:desktop.tags.mk-2fa-setting.done%<br> <li>%i18n:desktop.tags.mk-2fa-setting.done%<br>
<input type="number" v-model="token" class="ui"> <input type="number" v-model="token" class="ui">
<button @click="submit" class="ui primary">%i18n:desktop.tags.mk-2fa-setting.submit%</button> <button @click="submit" class="ui primary">%i18n:desktop.tags.mk-2fa-setting.submit%</button>
@ -23,8 +23,6 @@
<script lang="ts"> <script lang="ts">
import Vue from 'vue'; import Vue from 'vue';
import passwordDialog from '../../scripts/password-dialog';
import notify from '../../scripts/notify';
export default Vue.extend({ export default Vue.extend({
data() { data() {
@ -35,7 +33,10 @@ export default Vue.extend({
}, },
methods: { methods: {
register() { register() {
passwordDialog('%i18n:desktop.tags.mk-2fa-setting.enter-password%', password => { (this as any).apis.input({
title: '%i18n:desktop.tags.mk-2fa-setting.enter-password%',
type: 'password'
}).then(password => {
(this as any).api('i/2fa/register', { (this as any).api('i/2fa/register', {
password: password password: password
}).then(data => { }).then(data => {
@ -45,11 +46,14 @@ export default Vue.extend({
}, },
unregister() { unregister() {
passwordDialog('%i18n:desktop.tags.mk-2fa-setting.enter-password%', password => { (this as any).apis.input({
title: '%i18n:desktop.tags.mk-2fa-setting.enter-password%',
type: 'password'
}).then(password => {
(this as any).api('i/2fa/unregister', { (this as any).api('i/2fa/unregister', {
password: password password: password
}).then(() => { }).then(() => {
notify('%i18n:desktop.tags.mk-2fa-setting.unregistered%'); (this as any).apis.notify('%i18n:desktop.tags.mk-2fa-setting.unregistered%');
(this as any).os.i.two_factor_enabled = false; (this as any).os.i.two_factor_enabled = false;
}); });
}); });
@ -59,10 +63,10 @@ export default Vue.extend({
(this as any).api('i/2fa/done', { (this as any).api('i/2fa/done', {
token: this.token token: this.token
}).then(() => { }).then(() => {
notify('%i18n:desktop.tags.mk-2fa-setting.success%'); (this as any).apis.notify('%i18n:desktop.tags.mk-2fa-setting.success%');
(this as any).os.i.two_factor_enabled = true; (this as any).os.i.two_factor_enabled = true;
}).catch(() => { }).catch(() => {
notify('%i18n:desktop.tags.mk-2fa-setting.failed%'); (this as any).apis.notify('%i18n:desktop.tags.mk-2fa-setting.failed%');
}); });
} }
} }
@ -70,7 +74,7 @@ export default Vue.extend({
</script> </script>
<style lang="stylus" scoped> <style lang="stylus" scoped>
.mk-2fa-setting .2fa
color #4a535a color #4a535a
</style> </style>

View File

@ -1,5 +1,5 @@
<template> <template>
<div class="mk-mute-setting"> <div>
<div class="none ui info" v-if="!fetching && users.length == 0"> <div class="none ui info" v-if="!fetching && users.length == 0">
<p>%fa:info-circle%%i18n:desktop.tags.mk-mute-setting.no-users%</p> <p>%fa:info-circle%%i18n:desktop.tags.mk-mute-setting.no-users%</p>
</div> </div>
@ -18,7 +18,7 @@ export default Vue.extend({
data() { data() {
return { return {
fetching: true, fetching: true,
users: null users: []
}; };
}, },
mounted() { mounted() {

View File

@ -0,0 +1,47 @@
<template>
<div>
<button @click="reset" class="ui primary">%i18n:desktop.tags.mk-password-setting.reset%</button>
</div>
</template>
<script lang="ts">
import Vue from 'vue';
export default Vue.extend({
methods: {
reset() {
(this as any).apis.input({
title: '%i18n:desktop.tags.mk-password-setting.enter-current-password%',
type: 'password'
}).then(currentPassword => {
(this as any).apis.input({
title: '%i18n:desktop.tags.mk-password-setting.enter-new-password%',
type: 'password'
}).then(newPassword => {
(this as any).apis.input({
title: '%i18n:desktop.tags.mk-password-setting.enter-new-password-again%',
type: 'password'
}).then(newPassword2 => {
if (newPassword !== newPassword2) {
(this as any).apis.dialog({
title: null,
text: '%i18n:desktop.tags.mk-password-setting.not-match%',
actions: [{
text: 'OK'
}]
});
return;
}
(this as any).api('i/change_password', {
current_password: currentPassword,
new_password: newPassword
}).then(() => {
(this as any).apis.notify('%i18n:desktop.tags.mk-password-setting.changed%');
});
});
});
});
}
}
});
</script>

View File

@ -30,7 +30,7 @@
<section class="mute" v-show="page == 'mute'"> <section class="mute" v-show="page == 'mute'">
<h1>%i18n:desktop.tags.mk-settings.mute%</h1> <h1>%i18n:desktop.tags.mk-settings.mute%</h1>
<mk-mute-setting/> <x-mute/>
</section> </section>
<section class="apps" v-show="page == 'apps'"> <section class="apps" v-show="page == 'apps'">
@ -45,12 +45,12 @@
<section class="password" v-show="page == 'security'"> <section class="password" v-show="page == 'security'">
<h1>%i18n:desktop.tags.mk-settings.password%</h1> <h1>%i18n:desktop.tags.mk-settings.password%</h1>
<mk-password-setting/> <x-password/>
</section> </section>
<section class="2fa" v-show="page == 'security'"> <section class="2fa" v-show="page == 'security'">
<h1>%i18n:desktop.tags.mk-settings.2fa%</h1> <h1>%i18n:desktop.tags.mk-settings.2fa%</h1>
<mk-2fa-setting/> <x-2fa/>
</section> </section>
<section class="signin" v-show="page == 'security'"> <section class="signin" v-show="page == 'security'">
@ -74,10 +74,16 @@
<script lang="ts"> <script lang="ts">
import Vue from 'vue'; import Vue from 'vue';
import XProfile from './settings.profile.vue'; import XProfile from './settings.profile.vue';
import XMute from './settings.mute.vue';
import XPassword from './settings.password.vue';
import X2fa from './settings.2fa.vue';
export default Vue.extend({ export default Vue.extend({
components: { components: {
XProfile XProfile,
XMute,
XPassword,
X2fa
}, },
data() { data() {
return { return {

View File

@ -100,6 +100,7 @@ export default define({
> .ip > .ip
margin-right 4px margin-right 4px
padding 0 4px
> b > b
margin-right 4px margin-right 4px