Skip to content
This repository was archived by the owner on Mar 8, 2022. It is now read-only.

Commit 9a0c635

Browse files
committed
Test email with regex
1 parent a0f4d01 commit 9a0c635

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/subcommands/login/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,8 @@ export default class Login extends CLI {
257257
do {
258258
try {
259259
const input = await prompt<EmailInput>(inputQuestion);
260-
if (input.email.trim() === "") {
260+
const regex = /\S+@\S+\.\S+/;
261+
if (input.email.trim() === "" || !regex.test(input.email)) {
261262
Print.error("Enter a valid email. Press Ctrl-c or Esc key to exit.");
262263
} else {
263264
email = input.email;

0 commit comments

Comments
 (0)