This commit is contained in:
@@ -5,41 +5,56 @@
|
||||
|
||||
<md-field>
|
||||
<label>Username</label>
|
||||
<md-input :disabled="processing"></md-input>
|
||||
<md-input v-model="form.name" :disabled="authInProgress"></md-input>
|
||||
</md-field>
|
||||
|
||||
<md-field :md-toggle-password="false">
|
||||
<label>Password</label>
|
||||
<md-input type="password" :disabled="processing"></md-input>
|
||||
<md-input v-model="form.password" type="password" :disabled="authInProgress"></md-input>
|
||||
</md-field>
|
||||
|
||||
<md-field :md-toggle-password="false">
|
||||
<label>Confirm password</label>
|
||||
<md-input :disabled="processing" type="password"></md-input>
|
||||
<md-input v-model="form.passwordConfirm" :disabled="authInProgress" type="password"></md-input>
|
||||
</md-field>
|
||||
|
||||
</md-card-content>
|
||||
|
||||
<md-card-actions>
|
||||
<md-progress-spinner :md-diameter="30" :md-stroke="3" md-mode="indeterminate" v-if="processing"
|
||||
<md-progress-spinner :md-diameter="30" :md-stroke="3" md-mode="indeterminate" v-if="authInProgress"
|
||||
class="md-accent"></md-progress-spinner>
|
||||
<md-button type="submit" class="md-primary" :disabled="processing">Register</md-button>
|
||||
<md-button type="submit" class="md-primary" :disabled="authInProgress && passwordGood">Register</md-button>
|
||||
</md-card-actions>
|
||||
</form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapGetters} from "vuex";
|
||||
|
||||
export default {
|
||||
name: "Register",
|
||||
data() {
|
||||
return {
|
||||
processing: false
|
||||
form: {
|
||||
name: "",
|
||||
password: "",
|
||||
passwordConfirm: ""
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
performRegister() {
|
||||
this.processing = true;
|
||||
const creds = {name: this.form.name, password: this.form.password};
|
||||
this.$store.dispatch("performRegister", creds).then(() => {
|
||||
this.$router.push({name: 'Dashboard'});
|
||||
})
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['authInProgress']),
|
||||
passwordGood() {
|
||||
return this.form.password !== "" && this.form.password === this.form.passwordConfirm;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user