Skip to content

Commit 298e611

Browse files
committed
added middleware to block change email routes for social identities (google,facebook connections)
1 parent f57b737 commit 298e611

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

components/Profile/Shipping.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@
7878
export default {
7979
mixins: [validationMixin],
8080
mounted() {
81-
if (this.$store.getters['profile/getUserProfile'].profileIsCompleted) {
81+
if (this.$store.getters['profile/getUserProfile'].profileIsCompleted
82+
&& this.$store.getters['profile/getUserProfile'].mangoPayUser.Address.AddressLine1) {
8283
Object.assign(this.Address , this.$store.getters['profile/getUserProfile'].mangoPayUser.Address);
8384
}
8485
},

middleware/changeEmail.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export default async function({store, redirect}){
2+
if(store.state.auth.loggedIn) {
3+
await store.dispatch('profile/getUserProfile');
4+
5+
if(store.getters['profile/getUserProfile'].userAuth0.identities[0].isSocial) {
6+
return redirect('/profile')
7+
}
8+
}
9+
}

pages/profile/Email/index.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66

77
<script>
88
export default {
9-
name: "index"
9+
name: "index",
10+
middleware: 'changeEmail'
1011
}
1112
</script>
1213

0 commit comments

Comments
 (0)