feat: check for email format on l-register
This commit is contained in:
parent
7166559d19
commit
1bc944386b
1 changed files with 7 additions and 0 deletions
|
|
@ -17,6 +17,13 @@ if (!name || !role) {
|
|||
process.exit(2)
|
||||
}
|
||||
|
||||
const emailRegex = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
||||
|
||||
if (!emailRegex.test(name)) {
|
||||
console.log('Usage: <name> should be in an email format')
|
||||
process.exit(2)
|
||||
}
|
||||
|
||||
if (role !== 'user' && role !== 'superuser') {
|
||||
console.log('Usage: <role> has two possible values: user | superuser')
|
||||
process.exit(2)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue