[next] Email/Password Improvements (#2400)

* feat: improved some password/email fields

- All secret fields are now "hidden" by default
- All email fields now have autocomplete/spellcheck disabled with
  correct typings

* feat: add additional email validation
This commit is contained in:
Wyatt Johnson
2019-07-12 21:07:14 +00:00
committed by GitHub
parent f95b705585
commit bc0b0d0339
18 changed files with 584 additions and 190 deletions
@@ -1,3 +1,4 @@
import Joi from "joi";
import { Db } from "mongodb";
import { Strategy as LocalStrategy } from "passport-local";
@@ -18,11 +19,21 @@ const verifyFactory = (
emailLimiter: RequestLimiter
) => async (
req: Request,
email: string,
password: string,
emailInput: string,
passwordInput: string,
done: VerifyCallback
) => {
try {
// Validate that the email address and password are reasonable.
const email = Joi.attempt(
emailInput,
Joi.string()
.trim()
.lowercase()
.email()
);
const password = Joi.attempt(passwordInput, Joi.string());
await ipLimiter.test(req, req.ip);
await emailLimiter.test(req, email);