Skip to content

Commit da2cbc8

Browse files
committed
signup dev same as prod
1 parent 97f761d commit da2cbc8

2 files changed

Lines changed: 17 additions & 3 deletions

File tree

client/modules/User/actions.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,11 @@ export function validateAndLoginUser(formProps: {
9292
})
9393
);
9494
dispatch(justOpenedProject());
95-
browserHistory.push(previousPath);
95+
const path =
96+
previousPath === '/signup' || previousPath === '/login'
97+
? '/'
98+
: previousPath;
99+
browserHistory.push(path);
96100
resolve();
97101
})
98102
.catch((error) =>
@@ -123,7 +127,11 @@ export function validateAndSignUpUser(formValues: CreateUserRequestBody) {
123127
.then((response) => {
124128
dispatch(authenticateUser(response.data));
125129
dispatch(justOpenedProject());
126-
browserHistory.push(previousPath);
130+
const path =
131+
previousPath === '/signup' || previousPath === '/login'
132+
? '/'
133+
: previousPath;
134+
browserHistory.push(path);
127135
resolve();
128136
})
129137
.catch((error) => {

server/controllers/user.controller/signup.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,13 @@ export const createUser: RequestHandler<
7171
res.json(userResponse(user));
7272
} catch (mailErr) {
7373
console.error(mailErr);
74-
res.status(500).json({ error: 'Failed to send verification email.' });
74+
// In development, still return success so signup UX matches production
75+
// (redirect to home, user logged in). Email may be unconfigured locally.
76+
if (process.env.NODE_ENV !== 'production') {
77+
res.json(userResponse(user));
78+
} else {
79+
res.status(500).json({ error: 'Failed to send verification email.' });
80+
}
7581
}
7682
});
7783
} catch (err) {

0 commit comments

Comments
 (0)