Blame view

src/pages/Authentication/changepassword.vue 3.87 KB
93a68cfa1   Jatinder Singh   first commit
1
2
  <template>
    <v-app id="login">
8bb178441   Neeraj Sharma   implemnt api in s...
3
4
5
6
      <app-toolbar class="app--toolbar"></app-toolbar>
      <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...
7
            <v-toolbar class="fixcolors mt-5" dark>
8bb178441   Neeraj Sharma   implemnt api in s...
8
9
10
              <v-spacer></v-spacer>
              <v-toolbar-title>Technology Succes</v-toolbar-title>
              <v-spacer></v-spacer>
93a68cfa1   Jatinder Singh   first commit
11
            </v-toolbar>
8bb178441   Neeraj Sharma   implemnt api in s...
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
53
            <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
54
55
56
    </v-app>
  </template>
  <script>
8bb178441   Neeraj Sharma   implemnt api in s...
57
58
  import http from "@/Services/http.js";
  import AppToolbar from "@/components/pageHeader/AppToolbar";
03dcbf0c1   Neeraj Sharma   fix all api and r...
59

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