1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-12-05 10:18:38 +09:00

Merge branch 'develop' of https://github.com/syuilo/misskey into develop

This commit is contained in:
syuilo 2019-07-10 18:30:58 +09:00
commit ab871c6991
2 changed files with 14 additions and 1 deletions

View File

@ -43,7 +43,7 @@
</i18n> </i18n>
</ui-switch> </ui-switch>
<div v-if="meta.enableRecaptcha" class="g-recaptcha" :data-sitekey="meta.recaptchaSiteKey" style="margin: 16px 0;"></div> <div v-if="meta.enableRecaptcha" class="g-recaptcha" :data-sitekey="meta.recaptchaSiteKey" style="margin: 16px 0;"></div>
<ui-button type="submit" :disabled="!(meta.ToSUrl ? ToSAgreement : true) || passwordRetypeState == 'not-match'">{{ $t('create') }}</ui-button> <ui-button type="submit" :disabled=" submitting || !(meta.ToSUrl ? ToSAgreement : true) || passwordRetypeState == 'not-match'">{{ $t('create') }}</ui-button>
</template> </template>
</form> </form>
</template> </template>
@ -70,6 +70,7 @@ export default Vue.extend({
passwordStrength: '', passwordStrength: '',
passwordRetypeState: null, passwordRetypeState: null,
meta: {}, meta: {},
submitting: false,
ToSAgreement: false ToSAgreement: false
} }
}, },
@ -145,6 +146,9 @@ export default Vue.extend({
}, },
onSubmit() { onSubmit() {
if (this.submitting) return;
this.submitting = true;
this.$root.api('signup', { this.$root.api('signup', {
username: this.username, username: this.username,
password: this.password, password: this.password,
@ -159,6 +163,8 @@ export default Vue.extend({
location.href = '/'; location.href = '/';
}); });
}).catch(() => { }).catch(() => {
this.submitting = false;
this.$root.dialog({ this.$root.dialog({
type: 'error', type: 'error',
text: this.$t('some-error') text: this.$t('some-error')

View File

@ -104,6 +104,13 @@ export default async (ctx: Koa.BaseContext) => {
// Start transaction // Start transaction
await getConnection().transaction(async transactionalEntityManager => { await getConnection().transaction(async transactionalEntityManager => {
const exist = await transactionalEntityManager.findOne(User, {
usernameLower: username.toLowerCase(),
host: null
});
if (exist) throw 'already registered';
account = await transactionalEntityManager.save(new User({ account = await transactionalEntityManager.save(new User({
id: genId(), id: genId(),
createdAt: new Date(), createdAt: new Date(),