mirror of
https://github.com/supabase/supabase.git
synced 2026-10-19 16:19:10 +03:00
auth users search uid
This commit is contained in:
1 parent
6156133cfe
commit
480d0d28e3
3 files changed
+17
-16
No files matched your search
@@ -195,7 +195,7 @@ const UserDropdown = ({ user, canRemoveUser, canRemoveMFAFactors }: UserDropdown
|
||||
disabled={!canRemoveUser}
|
||||
className="space-x-2"
|
||||
>
|
||||
<IconTrash size="tiny" />
|
||||
<IconTrash size="tiny" stroke="red" />
|
||||
<p>Delete user</p>
|
||||
</DropdownMenuItem>
|
||||
</Tooltip.Trigger>
|
||||
|
||||
@@ -78,10 +78,10 @@ const Users = () => {
|
||||
onKeyDown={(e) => {
|
||||
if (e.keyCode == 13) setFilterKeywords(search)
|
||||
}}
|
||||
className="min-w-[275px]"
|
||||
className="min-w-[300px]"
|
||||
name="email"
|
||||
id="email"
|
||||
placeholder="Search by email or phone number"
|
||||
placeholder="Search by email, phone number or UID"
|
||||
icon={<IconSearch size="tiny" />}
|
||||
actions={[
|
||||
search && (
|
||||
|
||||
@@ -35,12 +35,13 @@ const handleGetAll = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
let queryUsers = ''
|
||||
|
||||
if (hasValidKeywords && !hasVerifiedValue) {
|
||||
queryCount = SqlString.format('SELECT count(*) from auth.users WHERE email ilike ?;', [
|
||||
`%${keywords}%`,
|
||||
])
|
||||
queryCount = SqlString.format(
|
||||
'SELECT count(*) from auth.users WHERE (email ilike ? OR id::text ilike ?);',
|
||||
[`%${keywords}%`, `%${keywords}%`]
|
||||
)
|
||||
queryUsers = SqlString.format(
|
||||
'SELECT * from auth.users WHERE email ilike ? ORDER BY created_at DESC LIMIT ? OFFSET ?;',
|
||||
[`%${keywords}%`, limitInt, offsetInt]
|
||||
'SELECT * from auth.users WHERE (email ilike ? OR id::text ilike ?) ORDER BY created_at DESC LIMIT ? OFFSET ?;',
|
||||
[`%${keywords}%`, `%${keywords}%`, limitInt, offsetInt]
|
||||
)
|
||||
}
|
||||
|
||||
@@ -68,22 +69,22 @@ const handleGetAll = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
if (hasValidKeywords && hasVerifiedValue) {
|
||||
if (verified === 'verified') {
|
||||
queryCount = SqlString.format(
|
||||
'SELECT count(*) from auth.users WHERE (email_confirmed_at IS NOT NULL or phone_confirmed_at IS NOT NULL) AND email ilike ?;',
|
||||
[`%${keywords}%`]
|
||||
'SELECT count(*) from auth.users WHERE (email_confirmed_at IS NOT NULL or phone_confirmed_at IS NOT NULL) AND (email ilike ? OR id::text ilike ?);',
|
||||
[`%${keywords}%`, `%${keywords}%`]
|
||||
)
|
||||
queryUsers = SqlString.format(
|
||||
'SELECT * from auth.users WHERE (email_confirmed_at IS NOT NULL or phone_confirmed_at IS NOT NULL) AND email ilike ? ORDER BY created_at DESC LIMIT ? OFFSET ?;',
|
||||
[`%${keywords}%`, limitInt, offsetInt]
|
||||
'SELECT * from auth.users WHERE (email_confirmed_at IS NOT NULL or phone_confirmed_at IS NOT NULL) AND (email ilike ? OR id::text ilike ?) ORDER BY created_at DESC LIMIT ? OFFSET ?;',
|
||||
[`%${keywords}%`, `%${keywords}%`, limitInt, offsetInt]
|
||||
)
|
||||
}
|
||||
if (verified === 'unverified') {
|
||||
queryCount = SqlString.format(
|
||||
'SELECT count(*) from auth.users WHERE (email_confirmed_at IS NULL AND phone_confirmed_at IS NULL) AND email ilike ?;',
|
||||
[`%${keywords}%`]
|
||||
'SELECT count(*) from auth.users WHERE (email_confirmed_at IS NULL AND phone_confirmed_at IS NULL) AND (email ilike ? OR id::text ilike ?);',
|
||||
[`%${keywords}%`, `%${keywords}%`]
|
||||
)
|
||||
queryUsers = SqlString.format(
|
||||
'SELECT * from auth.users WHERE (email_confirmed_at IS NULL AND phone_confirmed_at IS NULL) AND email ilike ? ORDER BY created_at DESC LIMIT ? OFFSET ?;',
|
||||
[`%${keywords}%`, limitInt, offsetInt]
|
||||
'SELECT * from auth.users WHERE (email_confirmed_at IS NULL AND phone_confirmed_at IS NULL) AND (email ilike ? OR id::text ilike ?) ORDER BY created_at DESC LIMIT ? OFFSET ?;',
|
||||
[`%${keywords}%`, `%${keywords}%`, limitInt, offsetInt]
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user