fix user creation condition (#275)
This commit is contained in:
		
							parent
							
								
									7ab400eb7f
								
							
						
					
					
						commit
						9cc30f25e4
					
				| 
						 | 
					@ -1,14 +1,14 @@
 | 
				
			||||||
<template>
 | 
					<template>
 | 
				
			||||||
  <div v-if="!user.perm.admin">
 | 
					  <div v-if="!user.perm.admin && !isNew">
 | 
				
			||||||
    <label for="password">{{ $t("settings.password") }}</label>
 | 
					    <label for="password">{{ $t("settings.password") }}</label>
 | 
				
			||||||
      <input
 | 
					    <input
 | 
				
			||||||
        class="input input--block"
 | 
					      class="input input--block"
 | 
				
			||||||
        type="password"
 | 
					      type="password"
 | 
				
			||||||
        placeholder="enter new password"
 | 
					      placeholder="enter new password"
 | 
				
			||||||
        v-model="user.password"
 | 
					      v-model="user.password"
 | 
				
			||||||
        id="password"
 | 
					      id="password"
 | 
				
			||||||
        @input="emitUpdate"
 | 
					      @input="emitUpdate"
 | 
				
			||||||
      />
 | 
					    />
 | 
				
			||||||
  </div>
 | 
					  </div>
 | 
				
			||||||
  <div v-else>
 | 
					  <div v-else>
 | 
				
			||||||
    <p v-if="!isDefault">
 | 
					    <p v-if="!isDefault">
 | 
				
			||||||
| 
						 | 
					@ -104,7 +104,7 @@ export default {
 | 
				
			||||||
  watch: {
 | 
					  watch: {
 | 
				
			||||||
    user: {
 | 
					    user: {
 | 
				
			||||||
      handler(newUser) {
 | 
					      handler(newUser) {
 | 
				
			||||||
        this.localUser = { ...newUser };  // Watch for changes in the parent and update the local copy
 | 
					        this.localUser = { ...newUser }; // Watch for changes in the parent and update the local copy
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      immediate: true,
 | 
					      immediate: true,
 | 
				
			||||||
      deep: true,
 | 
					      deep: true,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -111,14 +111,14 @@ export default {
 | 
				
			||||||
      try {
 | 
					      try {
 | 
				
			||||||
        if (this.isNew) {
 | 
					        if (this.isNew) {
 | 
				
			||||||
          const loc = await usersApi.create(this.userPayload); // Use the computed property
 | 
					          const loc = await usersApi.create(this.userPayload); // Use the computed property
 | 
				
			||||||
          this.$router.push({ path: loc });
 | 
					          this.$router.push({ path: "/settings", hash: "#users-main" });
 | 
				
			||||||
          notify.showSuccess(this.$t("settings.userCreated"));
 | 
					          notify.showSuccess(this.$t("settings.userCreated"));
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
          let which = ["all"];
 | 
					          let which = ["all"];
 | 
				
			||||||
          if (!this.user.perm.admin) {
 | 
					          if (!this.user.perm.admin) {
 | 
				
			||||||
            which = ["password"]
 | 
					            which = ["password"];
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
          await usersApi.update(this.userPayload,which);
 | 
					          await usersApi.update(this.userPayload, which);
 | 
				
			||||||
          notify.showSuccess(this.$t("settings.userUpdated"));
 | 
					          notify.showSuccess(this.$t("settings.userUpdated"));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      } catch (e) {
 | 
					      } catch (e) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										2
									
								
								makefile
								
								
								
								
							
							
						
						
									
										2
									
								
								makefile
								
								
								
								
							| 
						 | 
					@ -2,7 +2,7 @@
 | 
				
			||||||
setup:
 | 
					setup:
 | 
				
			||||||
	echo "creating ./backend/test_config.yaml for local testing..." && \
 | 
						echo "creating ./backend/test_config.yaml for local testing..." && \
 | 
				
			||||||
	if [ ! -f backend/test__config.yaml ]; then \
 | 
						if [ ! -f backend/test__config.yaml ]; then \
 | 
				
			||||||
		cp backend/filebrowser.yaml backend/test_config.yaml; \
 | 
							cp backend/config.yaml backend/test_config.yaml; \
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
	echo "installing swagger needed to generate backend api docs..." && \
 | 
						echo "installing swagger needed to generate backend api docs..." && \
 | 
				
			||||||
	go install github.com/swaggo/swag/cmd/swag@latest && \
 | 
						go install github.com/swaggo/swag/cmd/swag@latest && \
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue