Skip to content

Commit 0628dfd

Browse files
authored
Merge pull request #118 from krashish8/fix-bugs
Fix dashboard bugs
2 parents 00918e8 + 85d8726 commit 0628dfd

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/components/dashboard/DashboardProfile.vue

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ export default {
135135
return {
136136
certificate: null,
137137
resume: null,
138+
user_email: null,
138139
};
139140
},
140141
computed: {
@@ -154,10 +155,6 @@ export default {
154155
}
155156
},
156157
157-
user_email() {
158-
const { currentUser } = firebase.auth();
159-
if (currentUser) return currentUser.email;
160-
},
161158
162159
routerLocation() {
163160
return {
@@ -189,6 +186,11 @@ export default {
189186
.catch(e => {
190187
this.resume = null;
191188
});
189+
firebase.auth().onAuthStateChanged((user) => {
190+
if (user) {
191+
this.user_email = user.email;
192+
}
193+
})
192194
},
193195
methods: {
194196
clickToCopy() {

src/pages/ChangePassword.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,17 @@ export default {
7878
methods: {
7979
submitForm() {
8080
var user = firebase.auth().currentUser;
81+
const credential = firebase.auth.EmailAuthProvider.credential(user.email, this.currentPasswd);
8182
user
82-
.reauthenticateAndRetrieveDataWithCredential(this.currentPasswd)
83+
.reauthenticateAndRetrieveDataWithCredential(credential)
8384
.then(_ => {
8485
user
85-
.updatePassword(this.newPassword)
86+
.updatePassword(this.newPasswd)
8687
.then(_ => {
8788
this.$toasted.global.success({
8889
message: `Successfully updated password!`
8990
});
91+
this.$router.push({ name: "~/dashboard" });
9092
})
9193
.catch(err => {
9294
this.$toasted.global.error_post({ message: err.message });

0 commit comments

Comments
 (0)