fix/enhanced user input validation
This commit is contained in:
3 files changed
+8
-8
No files matched your search
@@ -20,7 +20,7 @@ module.exports = (users) => {
|
||||
|
||||
const credentialSchema = joi.object({
|
||||
email: joi.string().email().required(),
|
||||
password: joi.string().max(20).required(),
|
||||
password: joi.string().alphanum().max(20).required(),
|
||||
});
|
||||
|
||||
const valid = credentialSchema.validate(req.body);
|
||||
@@ -56,9 +56,9 @@ module.exports = (users) => {
|
||||
router.post("/signup", async (req, res) => {
|
||||
const userSchema = joi.object({
|
||||
email: joi.string().email().required(),
|
||||
name: joi.string().alphanum().max(20).required(),
|
||||
password: joi.string().max(20).min(8).required(),
|
||||
repassword: joi.string().max(20).min(8).required(),
|
||||
name: joi.string().pattern(new RegExp('^[a-zA-Z]+$')).max(20).required(),
|
||||
password: joi.string().alphanum().max(20).min(8).required(),
|
||||
repassword: joi.string().alphanum().max(20).min(8).required(),
|
||||
});
|
||||
|
||||
const valid = userSchema.validate(req.body);
|
||||
|
||||
+3
-3
@@ -311,9 +311,9 @@ module.exports = (middleware, users, plans, assets) => {
|
||||
router.post("/updateAccount", async (req, res) => {
|
||||
const accountSchema = joi.object({
|
||||
email: joi.string().email(),
|
||||
name: joi.string().alphanum().max(20),
|
||||
password: joi.string().max(20).min(8),
|
||||
repassword: joi.string().max(20).min(8),
|
||||
name: joi.string().pattern(new RegExp('^[a-zA-Z]+$')).max(20),
|
||||
password: joi.string().alphanum().max(20).min(8),
|
||||
repassword: joi.string().alphanum().max(20).min(8),
|
||||
});
|
||||
|
||||
const valid = accountSchema.validate(req.body);
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
<form action="/updateAccount" method="post" class="space-y-4 mt-4" id="account-form">
|
||||
|
||||
<label for="email" class="block text-sm font-medium text-gray-700">Email</label>
|
||||
<input id="email" disabled type="text" name="email" value="<%= user.email %>" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
|
||||
<input id="email" disabled type="email" name="email" value="<%= user.email %>" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
|
||||
|
||||
<label for="name" class="block text-sm font-medium text-gray-700">Name</label>
|
||||
<input id="name" disabled type="text" name="name" value="<%= user.name %>" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
|
||||
|
||||
Reference in new issue
Block a user