Skip to content

Commit

Permalink
Refactor form checkboxes and add password reset feature
Browse files Browse the repository at this point in the history
  • Loading branch information
shps951023 committed Apr 6, 2024
1 parent 27d2a97 commit 437b3d6
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/Frontend/src/views/UsersView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
<td>
<div class="resizable" style="height: 25px;scroll-behavior: smooth;overflow-y: auto;">
<div class=" form-check" v-for="(role, index) in roles" :key="index">
<input :disabled="item.Type == 'miniauth' || role.Enable==false" class="role_checkbox form-check-input" type="checkbox"
:value="role.Id" v-model="item.Roles">
<input :disabled="item.Type == 'miniauth' || role.Enable == false" class="role_checkbox form-check-input"
type="checkbox" :value="role.Id" v-model="item.Roles">
<label class="form-check-label" :for="'role_' + index">{{ role.Name }}</label>
</div>
</div>
Expand Down Expand Up @@ -146,8 +146,9 @@
<label for="roles">{{ $t("Roles") }}:</label>
<div style="height: 100px;scroll-behavior: smooth;overflow-y: auto;">
<div class=" form-check" v-for="(role, index) in roles" :key="index">
<input :disabled="editedUser.Type == 'miniauth' || role.Enable==false" class="role_checkbox form-check-input"
type="checkbox" :value="role.Id" v-model="editedUser.Roles">
<input :disabled="editedUser.Type == 'miniauth' || role.Enable == false"
class="role_checkbox form-check-input" type="checkbox" :value="role.Id"
v-model="editedUser.Roles">
<label class="form-check-label" :for="'role_' + index">{{ role.Name }}</label>
</div>
</div>
Expand All @@ -172,7 +173,7 @@
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">
{{ $t("Cancel") }}
</button>
<button type="button" @click="save(editedUser)" class="btn btn-primary">{{$t("Save")}}</button>
<button type="button" @click="save(editedUser)" class="btn btn-primary">{{ $t("Save") }}</button>
</div>
</div>
</div>
Expand Down Expand Up @@ -210,7 +211,6 @@ input[type="mail"] {
outline: 0;
background-color: rgba(226, 226, 226, 0.744);
}
</style>

<script setup>
Expand Down Expand Up @@ -268,7 +268,7 @@ const insert = async () => {
if (!confirm("Are you sure you want to insert?")) {
return;
}
users.value.push({ Id: null, Enable: true, Roles: []})
users.value.push({ Id: null, Enable: true, Roles: [] })
}
const deleteUser = async (Id) => {
Expand All @@ -286,6 +286,10 @@ const save = async (data) => {
}
await service.post('api/saveUser', data).then(async () => {
alert(t("updated_successfully"))
await service.post('api/resetPassword', data).then(async (res) => {
alert(t("new_password", [res.newPassword]))
navigator.clipboard.writeText(res.newPassword)
})
await fetchData();
})
}
Expand Down

0 comments on commit 437b3d6

Please sign in to comment.