Skip to content

Commit f6a67eb

Browse files
no tests
pull out email validation logic
1 parent db3dce4 commit f6a67eb

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

.github/workflows/unity-build.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ jobs:
3333
npm ci
3434
npm run build
3535
npm run link
36-
npm run tests
3736
unity-cli --version
3837
- name: setup unity
3938
shell: bash

src/license-client.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,9 +372,12 @@ export class LicensingClient {
372372
options.username = Buffer.from(encodedUsername, 'base64').toString('utf-8');
373373
}
374374

375-
const emailRegex: RegExp = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
375+
function isValidEmail(email: string): boolean {
376+
const emailRegex: RegExp = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
377+
return emailRegex.test(email);
378+
}
376379

377-
if (options.username.length === 0 || !emailRegex.test(options.username)) {
380+
if (options.username.length === 0 || !isValidEmail(options.username)) {
378381
throw Error('Username must be your Unity ID email address!');
379382
}
380383

0 commit comments

Comments
 (0)