Methods
(static) check(args) → {Promise.<Object>}
This method of login is the regular one,
also used in the official front-end app.
This will return a cookie named playerme_session
,
make sure you keep that cookie and send it on consequent requests.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
args |
Object |
Properties
|
Returns:
Resolves to user information
- Type
- Promise.<Object>
Example
auth
.check({ login: '<login>', password: '<password>' })
.then((user) => user)
.catch((error) => error.message)
(static) forgot(args) → {Promise.<Boolean>}
Request a reset link. This will send a code to the user's email.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
args |
Object |
Properties
|
Returns:
Resolves to true
if successful
- Type
- Promise.<Boolean>
Example
auth
.forgot({ username: '<username>' })
.then((success) => success)
.catch((error) => error.message)
(static) prelogin(args) → {Promise.<Object>}
This is useful if you want to separate login into 2 steps. It only requires an email or username, and if it exists, it'll return a user object. You will still need to send a normal login after this request to do the real login, this is merely a "search by email/username". Please note that this is heavily rate limited for security purposes.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
args |
Object |
Properties
|
Returns:
Resolves to user information
- Type
- Promise.<Object>
Example
auth
.prelogin({ login: '<login>' })
.then((user) => user)
.catch((error) => error.message)
(static) register(args, username, email, password, confirm) → {Promise.<Object>}
Register a new user
Parameters:
Name | Type | Description |
---|---|---|
args |
Object | |
username |
String | The username (min: 3, max: 20, regex: [a-zA-Z0-9_-]+$) |
email |
String | The email |
password |
String | The password (min: 8) |
confirm |
String | This should be the same as password |
Returns:
Resolves to a success message
- Type
- Promise.<Object>
Example
auth
.register({
email: '<email>',
username: '<username>',
password: '<password>',
confirm: '<confirm>'
})
.then((success) => success.message)
.catch((error) => error.message)
(static) reset(args) → {Promise.<Boolean>}
Resets the password
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
args |
Object |
Properties
|
Returns:
Resolves true
if successful
- Type
- Promise.<Boolean>
Example
auth
.reset({ code: '<code>', password: '<password>', confirm: '<confirm>' })
.then((success) => success)
.catch((error) => error.message)