Skip to content

Commit

Permalink
Update TOTP page with Vuetify components and improved user feedback
Browse files Browse the repository at this point in the history
* **UI Enhancements**
  - Add Vuetify components for buttons and lists
  - Apply consistent styling to buttons with color and spacing

* **User Feedback**
  - Implement toast notifications for success and error messages in TOTP operations
  - Provide clear feedback for renaming, deleting, generating, and activating TOTP validators
  • Loading branch information
SunWuyuan committed Nov 9, 2024
1 parent b0b07c4 commit f5de219
Showing 1 changed file with 28 additions and 5 deletions.
33 changes: 28 additions & 5 deletions src/pages/totp/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<v-container>
<v-row>
<v-col cols="12">
<v-btn @click="generateTOTP">生成新的TOTP验证器</v-btn>
<v-btn @click="generateTOTP" color="primary" class="mb-4">生成新的TOTP验证器</v-btn>
</v-col>
<v-col cols="12">
<v-list>
Expand All @@ -16,9 +16,9 @@
<v-list-item-subtitle>{{ totp.status }}</v-list-item-subtitle>
</v-list-item-content>
<v-list-item-action>
<v-btn @click.stop="renameTOTP(totp.id)">重命名</v-btn>
<v-btn @click.stop="deleteTOTP(totp.id)">删除</v-btn>
<v-btn @click.stop="activateTOTP(totp.id)">激活</v-btn>
<v-btn @click.stop="renameTOTP(totp.id)" color="info">重命名</v-btn>
<v-btn @click.stop="deleteTOTP(totp.id)" color="error">删除</v-btn>
<v-btn @click.stop="activateTOTP(totp.id)" color="success">激活</v-btn>
</v-list-item-action>
</v-list-item>
</v-list>
Expand Down Expand Up @@ -66,6 +66,12 @@ export default {
const response = await request.post("/totp/rename", { totpId, name: newName });
if (response.status === "success") {
this.fetchTOTPList();
this.$toast.add({
severity: "success",
summary: "成功",
detail: "TOTP验证器重命名成功",
life: 3000,
});
} else {
this.$toast.add({
severity: "error",
Expand All @@ -89,6 +95,12 @@ export default {
const response = await request.post("/totp/delete", { totpId });
if (response.status === "success") {
this.fetchTOTPList();
this.$toast.add({
severity: "success",
summary: "成功",
detail: "TOTP验证器删除成功",
life: 3000,
});
} else {
this.$toast.add({
severity: "error",
Expand All @@ -110,7 +122,12 @@ export default {
try {
const response = await request.post("/totp/generate");
if (response.status === "success") {
alert(`新的TOTP验证器已生成: ${response.data.secret}`);
this.$toast.add({
severity: "success",
summary: "成功",
detail: `新的TOTP验证器已生成: ${response.data.secret}`,
life: 3000,
});
this.fetchTOTPList();
} else {
this.$toast.add({
Expand All @@ -136,6 +153,12 @@ export default {
const response = await request.post("/totp/activate", { totpId, totpToken });
if (response.status === "success") {
this.fetchTOTPList();
this.$toast.add({
severity: "success",
summary: "成功",
detail: "TOTP验证器激活成功",
life: 3000,
});
} else {
this.$toast.add({
severity: "error",
Expand Down

0 comments on commit f5de219

Please sign in to comment.