-
Notifications
You must be signed in to change notification settings - Fork 7
/
link.js
33 lines (28 loc) · 1.03 KB
/
link.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const Pterodactyl = require( 'pterodactyl.js' );
const client = new Pterodactyl.Builder()
.setURL( 'https://pterodactyl.app/' )
.setAPIKey( 'API Key' )
.asAdmin();
let isAccountCredentials = ( username, email ) => {
return new Promise( ( resolve, reject ) => {
try {
let users = await client.getUsers();
let user = users.filter( user => user.username === username );
if ( !user ) return resolve( { correct: false, } );
if ( user.email ) {
resolve( { correct: true, user, } );
} else {
resolve( { correct: false, } );
}
} catch ( error ) {
reject( error );
}
} );
};
isAccountCredentials( 'demo', 'demo@pterodactyl.io' ).then( account => {
if ( account.correct ) {
console.log( 'Correct! The username and email provided are valid.' );
} else {
console.log( 'Incorrect! The username and email provided are invalid.' );
}
} ).catch( error => console.log( error ) );