Kaynağa Gözat

modify resetpassword and recovery

tomoya 2 yıl önce
ebeveyn
işleme
dca02faf08
2 değiştirilmiş dosya ile 41 ekleme ve 5 silme
  1. 5 5
      frontend/src/stores/main.ts
  2. 36 0
      frontend/src/views/Signup.vue

+ 5 - 5
frontend/src/stores/main.ts

@@ -159,7 +159,7 @@ export const useMainStore = defineStore("MainStoreId", {
                 }, payload.timeout);
             });
         },
-        async register(payload: IUserProfileRegister) {
+        async register(payload: IUserProfileCreate) {
             const loadingNotification = {
                 content: "Sgining up...",
                 showProgress: true,
@@ -181,7 +181,7 @@ export const useMainStore = defineStore("MainStoreId", {
               await this.checkApiError(error);
           }
         },
-        async passwordRecovery(payload: {username: string }) {
+        async passwordRecovery(username: string ) {
             const loadingNotification = {
                 content: "Sending password recovery email",
                 showProgress: true,
@@ -189,7 +189,7 @@ export const useMainStore = defineStore("MainStoreId", {
             try {
                 this.addNotification(loadingNotification);
                 await Promise.all([
-                  api.passwordRecovery(payload.username),
+                  api.passwordRecovery(username),
                   await new Promise<void>((resolve, _) => setTimeout(() => resolve(), 500)),
                 ]);
                 this.removeNotification(loadingNotification);
@@ -203,12 +203,12 @@ export const useMainStore = defineStore("MainStoreId", {
                 this.addNotification({ color: "error", content: "Incorrect username" });
             }
         },
-        async resetPassword(payload: {password: string; token: string }) {
+        async resetPassword(password: string, token: string) {
             const loadingNotification = { content: "Resetting password", showProgress: true };
             try {
                 this.addNotification(loadingNotification);
                 await Promise.all([
-                    api.resetPassword(payload.password, payload.token),
+                    api.resetPassword(token, password),
                     await new Promise<void>((resolve, _) => setTimeout(() => resolve(), 500)),
                 ]);
                 this.removeNotification(loadingNotification);

+ 36 - 0
frontend/src/views/Signup.vue

@@ -40,6 +40,7 @@ const width = computed(() => {
 // action
 async function submit() {
   if (confirmPassword.value === data.password) {
+    console.log("data", data.password);
     mainStore.register(data);
   } else {
     confirmState.value = true;
@@ -185,6 +186,41 @@ async function submit() {
       </v-col>
     </v-row>
   </v-container>
+
+  <!-- <v-container fluid class="d-flex fill-height">
+    <v-row align="center" justify="center">
+      <v-col :cols="width">
+        <v-card class="elevation-12">
+          <v-toolbar dark color="primary">
+            <v-toolbar-title>{{ appName }}</v-toolbar-title>
+            <v-spacer></v-spacer>
+            <v-btn to="/login">LogIn</v-btn>
+          </v-toolbar>
+          <v-card-text>
+            <v-form @keyup.enter="submit">
+              <v-text-field
+                @keyup.enter="submit"
+                v-model="email"
+                prepend-icon="person"
+                name="email"
+                label="Email"
+                type="text"
+              ></v-text-field>
+              <v-text-field
+                @keyup.enter="submit"
+                v-model="password"
+                prepend-icon="key"
+                name="password"
+                label="Password"
+                id="password"
+                type="password"
+              ></v-text-field>
+            </v-form>
+          </v-card-text>
+        </v-card>
+      </v-col>
+    </v-row>
+  </v-container> -->
 </template>
 
 <style lang="scss">