mirror of
https://github.com/Permissionless-Software-Foundation/ipfs-bch-wallet-service.git
synced 2026-09-21 16:52:03 -07:00
Merge pull request #71 from christroutner/unstable
fix(email validation): Removing email validation that was failing for some TLDs
This commit is contained in:
@@ -59,10 +59,12 @@ class UserController {
|
||||
throw new Error("Property 'email' must be a string!")
|
||||
}
|
||||
|
||||
const isEmail = await _this.validateEmail(user.email)
|
||||
if (!isEmail) {
|
||||
throw new Error("Property 'email' must be email format!")
|
||||
}
|
||||
// This validation is not permissive to different TLDs like this one:
|
||||
// someone@somewhere.link. Removing it until it can be updated.
|
||||
// const isEmail = await _this.validateEmail(user.email)
|
||||
// if (!isEmail) {
|
||||
// throw new Error("Property 'email' must be email format!")
|
||||
// }
|
||||
|
||||
if (!user.password || typeof user.password !== 'string') {
|
||||
throw new Error("Property 'password' must be a string!")
|
||||
|
||||
+23
-23
@@ -81,29 +81,29 @@ describe('Users', () => {
|
||||
}
|
||||
})
|
||||
|
||||
it('should reject signup if email property provided in wrong format', async () => {
|
||||
try {
|
||||
const options = {
|
||||
method: 'POST',
|
||||
url: `${LOCALHOST}/users`,
|
||||
data: {
|
||||
user: {
|
||||
email: 'badEmailFormat',
|
||||
password: 'test'
|
||||
}
|
||||
}
|
||||
}
|
||||
await axios(options)
|
||||
|
||||
assert(false, 'Unexpected result')
|
||||
} catch (err) {
|
||||
assert.equal(err.response.status, 422)
|
||||
assert.include(
|
||||
err.response.data,
|
||||
"Property 'email' must be email format"
|
||||
)
|
||||
}
|
||||
})
|
||||
// it('should reject signup if email property provided in wrong format', async () => {
|
||||
// try {
|
||||
// const options = {
|
||||
// method: 'POST',
|
||||
// url: `${LOCALHOST}/users`,
|
||||
// data: {
|
||||
// user: {
|
||||
// email: 'badEmailFormat',
|
||||
// password: 'test'
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// await axios(options)
|
||||
//
|
||||
// assert(false, 'Unexpected result')
|
||||
// } catch (err) {
|
||||
// assert.equal(err.response.status, 422)
|
||||
// assert.include(
|
||||
// err.response.data,
|
||||
// "Property 'email' must be email format"
|
||||
// )
|
||||
// }
|
||||
// })
|
||||
|
||||
it('should reject signup if no password property is provided', async () => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user