Blame view

src/pages/Authentication/changepassword.vue 3.72 KB
93a68cfa1   Jatinder Singh   first commit
1
2
  <template>
    <v-app id="login">
8bb178441   Neeraj Sharma   implemnt api in s...
3
4
5
      <v-container fluid fill-height>
        <v-layout>
          <v-flex xs12 sm8 md8 lg5 offset-sm2 offset-lg3 class="mt-5">
603a06702   Neeraj Sharma   implemented chang...
6
            <v-toolbar class="fixcolors mt-5" dark>
8bb178441   Neeraj Sharma   implemnt api in s...
7
8
9
              <v-spacer></v-spacer>
              <v-toolbar-title>Technology Succes</v-toolbar-title>
              <v-spacer></v-spacer>
93a68cfa1   Jatinder Singh   first commit
10
            </v-toolbar>
8bb178441   Neeraj Sharma   implemnt api in s...
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
            <v-card class="elevation-1 pa-3" id="form">
              <v-card-text>
                <v-flex xs12 sm8 md8 lg8 offset-sm2>
                  <v-form class="mt-3">
                    <v-text-field
                      :rules="[rules.required]"
                      v-model="adminChangePasswordcredentials.oldPassword"
                      label="Old Password"
                    ></v-text-field>
                    <v-text-field
                      v-model="adminChangePasswordcredentials.newPassword"
                      :rules="[rules.required]"
                      label="New Password"
                    ></v-text-field>
                  </v-form>
                </v-flex>
              </v-card-text>
              <v-card-actions>
                <v-flex text-xs-center>
                  <v-btn
                    class="mt-3"
                    round
                    color="black"
                    dark
                    large
                    :loading="loading"
                    @click="reset"
                  >Reset Password</v-btn>
                </v-flex>
              </v-card-actions>
              <v-snackbar
                :timeout="timeout"
                :top="y === 'top'"
                :right="x === 'right'"
                :vertical="mode === 'vertical'"
                v-model="snackbar"
                :color="color"
              >{{ text }}</v-snackbar>
            </v-card>
          </v-flex>
        </v-layout>
      </v-container>
93a68cfa1   Jatinder Singh   first commit
53
54
55
    </v-app>
  </template>
  <script>
8bb178441   Neeraj Sharma   implemnt api in s...
56
  import http from "@/Services/http.js";
03dcbf0c1   Neeraj Sharma   fix all api and r...
57

93a68cfa1   Jatinder Singh   first commit
58
  export default {
8bb178441   Neeraj Sharma   implemnt api in s...
59
    data() {
93a68cfa1   Jatinder Singh   first commit
60
      return {
03dcbf0c1   Neeraj Sharma   fix all api and r...
61
        snackbar: false,
8bb178441   Neeraj Sharma   implemnt api in s...
62
63
64
        y: "top",
        x: "right",
        mode: "",
03dcbf0c1   Neeraj Sharma   fix all api and r...
65
        timeout: 4000,
8bb178441   Neeraj Sharma   implemnt api in s...
66
        text: "",
b34ed827a   Jatinder Singh   changes
67
        adminChangePasswordcredentials: {},
04e3fbc56   Jatinder Singh   minor fix
68
69
70
        e1: true,
        e2: true,
        e3: true,
93a68cfa1   Jatinder Singh   first commit
71
72
        loading: false,
        valid: false,
8bb178441   Neeraj Sharma   implemnt api in s...
73
74
75
76
        text: "Password Changed",
        currentPassword: "",
        newPassword: "",
        confirmPassword: "",
04e3fbc56   Jatinder Singh   minor fix
77
        rules: {
8bb178441   Neeraj Sharma   implemnt api in s...
78
          required: value => !!value || "This password field is Required."
e3e2a04c6   Neeraj Sharma   first commit
79
          // min: v => (/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*])(?=.{8,})/).test(v) && v.length >= 8 || 'Min 8 characters upper case lower case symbol required'
8bb178441   Neeraj Sharma   implemnt api in s...
80
        }
93a68cfa1   Jatinder Singh   first commit
81
82
83
      };
    },
    methods: {
8bb178441   Neeraj Sharma   implemnt api in s...
84
      reset() {
03dcbf0c1   Neeraj Sharma   fix all api and r...
85
        var token = this.$store.state.token;
e173bab21   Jatinder Singh   api
86
        var userdata = {
8bb178441   Neeraj Sharma   implemnt api in s...
87
88
89
90
91
92
93
          oldPassword: this.adminChangePasswordcredentials.oldPassword,
          newPassword: this.adminChangePasswordcredentials.newPassword
        };
        http()
          .put("/schoolChangePassword", userdata, {
            headers: { Authorization: "Bearer " + token }
          })
e173bab21   Jatinder Singh   api
94
          .then(response => {
03dcbf0c1   Neeraj Sharma   fix all api and r...
95
            this.loading = true;
8bb178441   Neeraj Sharma   implemnt api in s...
96
97
98
99
100
101
102
103
104
            if ((this.snackbar = true)) {
              this.text = "Successfully changed password !!";
              console.log("snackbar", response.data.message);
            }
            setTimeout(() => {
              this.$router.push("/dashboard");
            }, 2000);
          })
          .catch(err => {
03dcbf0c1   Neeraj Sharma   fix all api and r...
105
            // console.log("err====>",err);
8bb178441   Neeraj Sharma   implemnt api in s...
106
107
108
109
            this.text = "User Not Found or Incorrect currentPassword";
            this.snackbar = true;
            this.loading = false;
          });
93a68cfa1   Jatinder Singh   first commit
110
      }
03dcbf0c1   Neeraj Sharma   fix all api and r...
111
    },
8bb178441   Neeraj Sharma   implemnt api in s...
112
113
114
115
    computed: {
      color() {
        return this.loading ? "success" : "error";
      }
1c1942362   Neeraj Sharma   commit code Schoo...
116
    }
93a68cfa1   Jatinder Singh   first commit
117
118
  };
  </script>
04e3fbc56   Jatinder Singh   minor fix
119
  <style scoped>
8bb178441   Neeraj Sharma   implemnt api in s...
120
121
122
123
  img {
    position: absolute;
    top: 13px;
    left: 50px;
93a68cfa1   Jatinder Singh   first commit
124
  }
04e3fbc56   Jatinder Singh   minor fix
125
  .v-btn--large {
8bb178441   Neeraj Sharma   implemnt api in s...
126
    padding: 0px 74px;
04e3fbc56   Jatinder Singh   minor fix
127
  }
8bb178441   Neeraj Sharma   implemnt api in s...
128
129
  @media screen and (max-width: 769px) {
    .v-btn--large {
f42c1d9c9   Neeraj Sharma   something change ...
130
131
132
      font-size: 14px;
      height: 44px;
      padding: 0 32px;
8bb178441   Neeraj Sharma   implemnt api in s...
133
    }
f42c1d9c9   Neeraj Sharma   something change ...
134
  }
04e3fbc56   Jatinder Singh   minor fix
135
  </style>