Skip to content

Commit

Permalink
Fix some issues on UI
Browse files Browse the repository at this point in the history
  • Loading branch information
hoangvvo committed Sep 24, 2021
1 parent 23f295c commit f406411
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 11 deletions.
1 change: 0 additions & 1 deletion api-lib/auth/passport.js
Expand Up @@ -6,7 +6,6 @@ passport.serializeUser((user, done) => {
done(null, user._id);
});

// passport#160
passport.deserializeUser((req, id, done) => {
findUserForAuth(req.db, id).then(
(user) => done(null, user),
Expand Down
1 change: 1 addition & 0 deletions assets/base.css
@@ -1,3 +1,4 @@
/* Inspired by Vercel design */
@import 'node_modules/modern-normalize/modern-normalize.css';

:root {
Expand Down
3 changes: 1 addition & 2 deletions page-components/VerifyEmail/index.jsx
Expand Up @@ -5,7 +5,6 @@ import Link from 'next/link';
import styles from './VerifyEmail.module.css';

export const VerifyEmail = ({ valid }) => {
valid = true;
return (
<Wrapper className={styles.root}>
<Container column alignItems="center">
Expand All @@ -18,7 +17,7 @@ export const VerifyEmail = ({ valid }) => {
: 'It looks like you may have clicked on an invalid link. Please close this window and try again.'}
</Text>
<Spacer size={4} axis="vertical" />
<Link href="/">
<Link href="/" passHref>
<ButtonLink variant="ghost" type="success" size="large">
Go back home
</ButtonLink>
Expand Down
4 changes: 2 additions & 2 deletions pages/api/users/index.js
@@ -1,6 +1,6 @@
import { ValidateProps } from '@/api-lib/constants';
import { findUserByEmail, findUserByUsername, insertUser } from '@/api-lib/db';
import { auths, database, validateBody } from '@/api-lib/middlewares';
import { database, validateBody } from '@/api-lib/middlewares';
import { ncOpts } from '@/api-lib/nc';
import { slugUsername } from '@/lib/user';
import nc from 'next-connect';
Expand All @@ -9,7 +9,7 @@ import normalizeEmail from 'validator/lib/normalizeEmail';

const handler = nc(ncOpts);

handler.use(database, ...auths);
handler.use(database);

handler.post(
validateBody({
Expand Down
6 changes: 2 additions & 4 deletions pages/forget-password/[token].jsx
Expand Up @@ -18,15 +18,13 @@ const ResetPasswordTokenPage = ({ valid, token }) => {
export async function getServerSideProps(context) {
await nc().use(database).run(context.req, context.res);

const { token } = context.query;

const tokenDoc = await findTokenByIdAndType(
context.req.db,
context.query.token,
context.params.token,
'passwordReset'
);

return { props: { token, valid: !!tokenDoc } };
return { props: { token: context.params.token, valid: !!tokenDoc } };
}

export default ResetPasswordTokenPage;
4 changes: 2 additions & 2 deletions pages/verify-email/[token].jsx
Expand Up @@ -9,7 +9,7 @@ export default function EmailVerifyPage({ valid }) {
return (
<>
<Head>
<title>Sign up</title>
<title>Email verification</title>
</Head>
<VerifyEmail valid={valid} />
</>
Expand All @@ -21,7 +21,7 @@ export async function getServerSideProps(context) {
handler.use(database);
await handler.run(context.req, context.res);

const { token } = context.query;
const { token } = context.params;

const deletedToken = await findAndDeleteTokenByIdAndType(
context.req.db,
Expand Down

0 comments on commit f406411

Please sign in to comment.