added login stuff
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-12-06 01:43:47 +01:00
parent 0a09a1b0b7
commit 633f2af5eb
11 changed files with 255 additions and 33 deletions

View File

@@ -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;
}
}
}