Skip to content

Commit

Permalink
fix(Register): email collission
Browse files Browse the repository at this point in the history
  • Loading branch information
jkklapp committed Jun 6, 2022
1 parent c1233f1 commit 6bc23e3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 2 additions & 3 deletions backend/src/users/users.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ export class UsersService {
}

async userEmailExists(userEmail: string): Promise<boolean> {
return getByEmail(userEmail)
.then(() => true)
.catch(() => false);
const user = await getByEmail(userEmail);
return user !== null && user !== undefined;
}
}
9 changes: 8 additions & 1 deletion frontend/src/components/Register.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@
@blur.prevent="validate('name')"
/>
</div>
<span v-if="userNameExists" class="text-red text-xs"
<span
v-if="userNameExists"
class="text-red-700 dark:text-red-300 text-xs"
>This username already exists</span
>
</div>
Expand Down Expand Up @@ -66,6 +68,11 @@
@blur.prevent="validate('email')"
/>
</div>
<span
v-if="userEmailExists"
class="text-red-700 dark:text-red-300 text-xs"
>This email already exists</span
>
</div>
<div class="mb-6">
<label
Expand Down

0 comments on commit 6bc23e3

Please sign in to comment.