-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow admins to view user email (#3261)
- Loading branch information
1 parent
d9983de
commit 975427b
Showing
3 changed files
with
140 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<template> | ||
<div class="normal-page no-sidebar"> | ||
<h1>User account request</h1> | ||
<div class="normal-page__content"> | ||
<div class="card flex flex-col gap-3"> | ||
<div class="flex flex-col gap-2"> | ||
<label for="name"> | ||
<span class="text-lg font-semibold text-contrast"> | ||
User email | ||
<span class="text-brand-red">*</span> | ||
</span> | ||
</label> | ||
<input | ||
id="name" | ||
v-model="userEmail" | ||
type="email" | ||
maxlength="64" | ||
:placeholder="`Enter user email...`" | ||
autocomplete="off" | ||
/> | ||
</div> | ||
<div class="flex gap-2"> | ||
<ButtonStyled color="brand"> | ||
<button @click="getUserFromEmail"> | ||
<MailIcon aria-hidden="true" /> | ||
Get user account | ||
</button> | ||
</ButtonStyled> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
<script setup lang="ts"> | ||
import { ButtonStyled } from "@modrinth/ui"; | ||
import { MailIcon } from "@modrinth/assets"; | ||
const userEmail = ref(""); | ||
async function getUserFromEmail() { | ||
startLoading(); | ||
try { | ||
const result = await useBaseFetch(`user_email?email=${encodeURIComponent(userEmail.value)}`, { | ||
method: "GET", | ||
apiVersion: 3, | ||
}); | ||
await navigateTo(`/user/${result.username}`); | ||
} catch (err) { | ||
console.error(err); | ||
addNotification({ | ||
group: "main", | ||
title: "An error occurred", | ||
text: err.data.description, | ||
type: "error", | ||
}); | ||
} | ||
stopLoading(); | ||
} | ||
</script> |
22 changes: 22 additions & 0 deletions
22
...abrinth/.sqlx/query-68619337ef34b588af21a40e5a60b54ce3a1dad45fb50bbc24a3ea34d2506578.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters