+
+
+
{{ user.displayName || 'USER' }}
- Author
+ Admin
@@ -48,82 +49,112 @@
-
- Edit
- Suspend
-
-
-
+
+
+
-
+
mdi-account
Account
-
- mdi-shield-key
- Security
-
-
- mdi-credit-card
- Billing & Plans
-
-
- mdi-bell
- Notifications
-
-
- mdi-link
- Connections
-
-
-
Change Password
+
+ Change Password
+
+
+ Ensure that these requirements are met
+ Minimum 8 characters long, uppercase & symbol
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Change Password
+
+
+
+
+
+
+
+
+ mdi-pencil
+ Edit Details
+
+
+ mdi-delete
+ Delete Account
+
+
+
+
+
+
+
+
+ Edit Profile Details
-
- Ensure that these requirements are met
- Minimum 8 characters long, uppercase & symbol
-
-
-
-
-
-
-
-
-
-
-
-
-
- Change Password
-
+
+
+
+
-
+
+
+ Save
+ Cancel
+
+
+
+
+
+
+
+ Delete Account
+
+ Are you absolutely sure? This action cannot be undone. This will permanently delete your account and remove your data from our servers.
+
+
+
+ Delete Account
+ Cancel
+
+
+
+
@@ -132,6 +163,7 @@ import {
getAuth,
reauthenticateWithCredential,
EmailAuthProvider,
+ updatePassword,
} from 'firebase/auth'
import {
getFirestore,
@@ -141,7 +173,8 @@ import {
getDocs,
doc,
deleteDoc,
- getDoc
+ getDoc,
+ updateDoc
} from 'firebase/firestore'
export default {
@@ -155,9 +188,13 @@ export default {
contactNo: null,
country: null
},
+ editProfileData: {
+ username: null,
+ contactNo: null,
+ country: null
+ },
displayMissingInfo: 'INFO MISSING',
- loading:true,
- showDeleteModal: false,
+ loading: true,
valid: false,
newPassword: '',
confirmPassword: '',
@@ -170,14 +207,23 @@ export default {
confirmPasswordRules: [
v => !!v || 'Confirm password is required',
v => v === this.newPassword || 'Passwords must match'
- ]
+ ],
+ editProfileDialog: false,
+ deleteAccountDialog: false,
+ isSmallScreen: false
}
},
async created() {
await this.fetchUserProfile()
+ this.checkScreenSize()
+ window.addEventListener('resize', this.checkScreenSize)
},
-
+
+ beforeDestroy() {
+ window.removeEventListener('resize', this.checkScreenSize)
+ },
+
computed: {
user() {
return this.$store.getters.user || { email: '' }
@@ -185,6 +231,10 @@ export default {
},
methods: {
+ checkScreenSize() {
+ this.isSmallScreen = window.innerWidth < 960 // Adjust breakpoint as needed
+ },
+
async fetchUserProfile() {
try {
const auth = getAuth()
@@ -207,8 +257,45 @@ export default {
} catch (error) {
console.error('Error fetching profile:', error)
this.$toast.error('Failed to load profile data')
- }finally{
- this.loading = false;
+ } finally {
+ this.loading = false
+ }
+ },
+
+ openEditProfileDialog() {
+ this.editProfileData = {
+ username: this.userprofile.username,
+ contactNo: this.userprofile.contactNo,
+ country: this.userprofile.country
+ }
+ this.editProfileDialog = true
+ },
+
+ async saveProfile() {
+ try {
+ const auth = getAuth()
+ const user = auth.currentUser
+
+ if (user) {
+ const db = getFirestore()
+ const userDocRef = doc(db, 'users', user.uid)
+ await updateDoc(userDocRef, {
+ username: this.editProfileData.username,
+ contactNo: this.editProfileData.contactNo,
+ country: this.editProfileData.country
+ })
+ this.userprofile = {
+ ...this.userprofile,
+ username: this.editProfileData.username,
+ contactNo: this.editProfileData.contactNo,
+ country: this.editProfileData.country
+ }
+ this.$toast.success('Profile updated successfully')
+ this.editProfileDialog = false
+ }
+ } catch (error) {
+ console.error('Error updating profile:', error)
+ this.$toast.error('Failed to update profile')
}
},
@@ -222,7 +309,6 @@ export default {
await updatePassword(user, this.newPassword)
this.$toast.success('Password changed successfully')
- // Reset form
this.newPassword = ''
this.confirmPassword = ''
this.$refs.passwordForm.reset()
@@ -294,14 +380,6 @@ export default {
.catch((error) => {console.log(error)})
})
},
-
- editProfile() {
- this.$router.push('/editprofile');
- console.log("Edit profile clicked");
- },
- suspendAccount() {
- console.log("Suspend account clicked");
- },
},
}
@@ -320,7 +398,12 @@ export default {
background-color: #f8f9fe !important;
border-radius: 8px !important;
height: 100%;
- margin-left: -120px !important;
+}
+
+.password-card {
+ box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
+ border-radius: 10px;
+ padding: 20px;
}
.v-btn {
@@ -329,39 +412,12 @@ export default {
letter-spacing: 0 !important;
}
-.v-text-field ::v-deep(.class-name) .v-input__slot,
+.v-text-field ::v-deep(.v-input__slot),
.v-select ::v-deep .v-input__slot {
min-height: 40px !important;
box-shadow: none !important;
}
-.form-section label {
- color: #666 !important;
-}
-
-/* Adjustments for the layout */
-.profile-card {
- width: 100%;
- margin-bottom: 2rem;
- height: 100vh; /* Ensures the profile card covers the full screen height */
-}
-
-.v-tabs {
- margin-bottom: 2rem;
-}
-
-.v-tab {
- text-transform: none !important;
- letter-spacing: 0 !important;
-}
-
-.v-card {
- border-radius: 20px !important;
- margin-left: -200px;
-
-}
-
-
.v-list-item {
min-height: 40px !important;
}
@@ -370,42 +426,19 @@ export default {
color: #666 !important;
}
-.v-btn.edit-button {
- background-color: #007bff;
- color: white !important;
- border-radius: 8px;
- font-weight: 500;
- padding: 8px 16px;
- letter-spacing: 0.5px;
- box-shadow: 0 4px 6px rgba(0, 123, 255, 0.3);
- transition: background-color 0.3s ease, box-shadow 0.3s ease;
+.missing-info {
+ color: #ff5252 !important;
+ font-style: italic;
}
-.v-btn.edit-button:hover {
- background-color: #0056b3;
- box-shadow: 0 6px 10px rgba(0, 123, 255, 0.5);
-}
+@media (max-width: 960px) {
+ .container {
+ flex-direction: column;
+ }
-.v-btn.suspend-button {
- background-color: #dc3545;
- color: white !important;
- border-radius: 8px;
- font-weight: 500;
- padding: 8px 16px;
- letter-spacing: 0.5px;
- box-shadow: 0 4px 6px rgba(220, 53, 69, 0.3);
- transition: background-color 0.3s ease, box-shadow 0.3s ease;
+ .profile-card {
+ max-width: 100%;
+ min-width: 100%;
+ }
}
-
-.v-btn.suspend-button:hover {
- background-color: #c82333;
- box-shadow: 0 6px 10px rgba(220, 53, 69, 0.5);
-}
-
-.password-card {
- box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
- border-radius: 10px;
- padding: 20px;
-}
-
-
+
\ No newline at end of file