Improve readability

This commit is contained in:
syuilo 2018-12-19 00:39:28 +09:00
parent cddbbdf5d0
commit 57150fd910
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69
1 changed files with 8 additions and 0 deletions

View File

@ -50,6 +50,7 @@ import { toUnicode } from 'punycode';
export default Vue.extend({ export default Vue.extend({
i18n: i18n('common/views/components/signup.vue'), i18n: i18n('common/views/components/signup.vue'),
data() { data() {
return { return {
host: toUnicode(host), host: toUnicode(host),
@ -64,6 +65,7 @@ export default Vue.extend({
meta: null meta: null
} }
}, },
computed: { computed: {
shouldShowProfileUrl(): boolean { shouldShowProfileUrl(): boolean {
return (this.username != '' && return (this.username != '' &&
@ -72,17 +74,20 @@ export default Vue.extend({
this.usernameState != 'max-range'); this.usernameState != 'max-range');
} }
}, },
created() { created() {
this.$root.getMeta().then(meta => { this.$root.getMeta().then(meta => {
this.meta = meta; this.meta = meta;
}); });
}, },
mounted() { mounted() {
const head = document.getElementsByTagName('head')[0]; const head = document.getElementsByTagName('head')[0];
const script = document.createElement('script'); const script = document.createElement('script');
script.setAttribute('src', 'https://www.google.com/recaptcha/api.js'); script.setAttribute('src', 'https://www.google.com/recaptcha/api.js');
head.appendChild(script); head.appendChild(script);
}, },
methods: { methods: {
onChangeUsername() { onChangeUsername() {
if (this.username == '') { if (this.username == '') {
@ -111,6 +116,7 @@ export default Vue.extend({
this.usernameState = 'error'; this.usernameState = 'error';
}); });
}, },
onChangePassword() { onChangePassword() {
if (this.password == '') { if (this.password == '') {
this.passwordStrength = ''; this.passwordStrength = '';
@ -120,6 +126,7 @@ export default Vue.extend({
const strength = getPasswordStrength(this.password); const strength = getPasswordStrength(this.password);
this.passwordStrength = strength > 0.7 ? 'high' : strength > 0.3 ? 'medium' : 'low'; this.passwordStrength = strength > 0.7 ? 'high' : strength > 0.3 ? 'medium' : 'low';
}, },
onChangePasswordRetype() { onChangePasswordRetype() {
if (this.retypedPassword == '') { if (this.retypedPassword == '') {
this.passwordRetypeState = null; this.passwordRetypeState = null;
@ -128,6 +135,7 @@ export default Vue.extend({
this.passwordRetypeState = this.password == this.retypedPassword ? 'match' : 'not-match'; this.passwordRetypeState = this.password == this.retypedPassword ? 'match' : 'not-match';
}, },
onSubmit() { onSubmit() {
this.$root.api('signup', { this.$root.api('signup', {
username: this.username, username: this.username,