Skip to content

Commit 8497b8f

Browse files
committed
feat(*): signing up
1 parent ec44121 commit 8497b8f

File tree

5 files changed

+11
-12
lines changed

5 files changed

+11
-12
lines changed

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/backend/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ryot"
3-
version = "6.0.0"
3+
version = "6.0.1"
44
edition = "2021"
55
repository = "https://github.com/IgnisDa/ryot"
66
license = "GPL-3.0"

apps/backend/src/miscellaneous/resolver.rs

+1
Original file line numberDiff line numberDiff line change
@@ -4737,6 +4737,7 @@ impl MiscellaneousService {
47374737
UserLot::Normal
47384738
};
47394739
let user = user::ActiveModel {
4740+
id: ActiveValue::Set(format!("usr_{}", nanoid!(12))),
47404741
name: ActiveValue::Set(username),
47414742
password: ActiveValue::Set(password),
47424743
oidc_issuer_id: ActiveValue::Set(oidc_issuer_id),

apps/frontend/app/routes/_dashboard.settings.users.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ export default function Page() {
174174
</Form>
175175
</Modal>
176176
{loaderData.usersList.map((user) => (
177-
<Paper p="xs" withBorder key={user.id}>
177+
<Paper p="xs" withBorder key={user.id} data-user-id={user.id}>
178178
<Flex align="center" justify="space-between">
179179
<Box>
180180
<Text>{user.name}</Text>

apps/frontend/app/routes/auth.tsx

+7-9
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ import {
4848
} from "~/lib/utilities.server";
4949

5050
const searchParamsSchema = z.object({
51-
defaultForm: z.enum(["login", "register"]).optional(),
51+
intent: z.enum(["login", "register"]).optional(),
5252
});
5353

5454
export type SearchParams = z.infer<typeof searchParamsSchema> &
@@ -66,7 +66,7 @@ export const loader = async ({ request }: LoaderFunctionArgs) => {
6666
gqlClient.request(CoreDetailsDocument),
6767
]);
6868
return json({
69-
defaultForm: query.defaultForm || "login",
69+
intent: query.intent || "login",
7070
oidcEnabled: coreDetails.oidcEnabled,
7171
localAuthDisabled: coreDetails.localAuthDisabled,
7272
tokenValidForDays: coreDetails.tokenValidForDays,
@@ -115,11 +115,9 @@ export const action = async ({ request }: ActionFunctionArgs) => {
115115
headers: await createToastHeaders({ message, type: "error" }),
116116
});
117117
}
118-
return json({} as const, {
119-
headers: await createToastHeaders({
120-
type: "success",
121-
message: "Please login with your new credentials",
122-
}),
118+
return redirectWithToast($path("/auth"), {
119+
type: "success",
120+
message: "Please login with your new credentials",
123121
});
124122
},
125123
login: async () => {
@@ -200,7 +198,7 @@ export default function Page() {
200198
const [parent] = useAutoAnimate();
201199
const [searchParams] = useSearchParams();
202200
const redirectValue = searchParams.get(redirectToQueryParam);
203-
const intent = loaderData.defaultForm;
201+
const intent = loaderData.intent;
204202

205203
return (
206204
<Stack
@@ -275,7 +273,7 @@ export default function Page() {
275273
ta="right"
276274
component={Link}
277275
to={withQuery(".", {
278-
defaultForm: intent === "login" ? "register" : "login",
276+
intent: intent === "login" ? "register" : "login",
279277
})}
280278
>
281279
{

0 commit comments

Comments
 (0)