fix email search

This commit is contained in:
Phillip Thelen
2024-08-22 11:33:52 +02:00
parent cea9743087
commit d872ba49fd
2 changed files with 15 additions and 8 deletions
@@ -25,14 +25,14 @@
</div>
<p
class="mb-1"
:class="{'font-weight-bold': matchValueToIdentifier(user.auth.local.username)}"
:class="{'highlighted-value': matchValueToIdentifier(user.auth.local.username)}"
>
@{{ user.auth.local.username }}</p>
<p class="mb-0">
<span
v-for="email in userEmails(user)"
:key="email"
:class="{'font-weigh-bold': matchValueToIdentifier(email)}"
:class="{'highlighted-value': matchValueToIdentifier(email)}"
>
{{ email }}
</span>
@@ -42,6 +42,12 @@
</div>
</template>
<style lang="scss" scoped>
.highlighted-value {
font-weight: bold;
}
</style>
<script>
import VueRouter from 'vue-router';
import { mapState } from '@/libs/store';
@@ -101,14 +107,15 @@ export default {
const emails = user.auth.google.emails;
allEmails.push(...this.findSocialEmails(emails));
}
if (user.auth.apple && user.auth.apple.email) {
if (user.auth.apple && user.auth.apple.emails) {
const emails = user.auth.apple.emails;
allEmails.push(...this.findSocialEmails(emails));
}
if (user.auth.facebook && user.auth.facebook.email) {
if (user.auth.facebook && user.auth.facebook.emails) {
const emails = user.auth.facebook.emails;
allEmails.push(...this.findSocialEmails(emails));
}
console.log(allEmails);
return allEmails;
},
findSocialEmails (emails) {
+4 -4
View File
@@ -42,9 +42,9 @@ api.getHero = {
} else if (validator.isEmail(userIdentifier)) {
const emailFields = [
'auth.local.email',
'auth.google.email',
'auth.apple.email',
'auth.facebook.email',
'auth.google.emails.value',
'auth.apple.emails.value',
'auth.facebook.emails.value',
];
for (const field of emailFields) {
const emailQuery = { [field]: userIdentifier };
@@ -53,7 +53,7 @@ api.getHero = {
.select('contributor backer profile auth')
.lean()
.exec();
if (found && found.size >= 0) {
if (found) {
users.push(found);
}
}