-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #310 from TaloDev/develop
Release 0.36.0
- Loading branch information
Showing
50 changed files
with
2,257 additions
and
92 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,243 @@ | ||
import PlayerAuthAPIService from '../services/api/player-auth-api.service' | ||
import APIDocs from './api-docs' | ||
|
||
const PlayerAuthAPIDocs: APIDocs<PlayerAuthAPIService> = { | ||
register: { | ||
description: 'Create a new player account', | ||
params: { | ||
body: { | ||
identifier: 'The unique identifier of the player. This can be their username, an email or a numeric ID', | ||
password: 'The password the player will login with', | ||
verificationEnabled: 'When enabled, the player will be sent a verification code to their email address before they can login', | ||
email: 'Required when verification is enabled. This is also used for password resets: players without an email cannot reset their password' | ||
} | ||
}, | ||
samples: [ | ||
{ | ||
title: 'Sample request', | ||
sample: { | ||
identifier: 'boz', | ||
password: 'password', | ||
verificationEnabled: true, | ||
email: '[email protected]' | ||
} | ||
}, | ||
{ | ||
title: 'Sample response', | ||
sample: { | ||
alias: { | ||
id: 1, | ||
service: 'talo', | ||
identifier: 'boz', | ||
player: { | ||
id: '7a4e70ec-6ee6-418e-923d-b3a45051b7f9', | ||
props: [], | ||
aliases: [ | ||
'/* [Circular] */' | ||
], | ||
devBuild: false, | ||
createdAt: '2024-06-28 12:37:43', | ||
lastSeenAt: '2024-06-28 12:37:43', | ||
groups: [], | ||
auth: { | ||
email: '[email protected]', | ||
verificationEnabled: true, | ||
sessionCreatedAt: '2024-06-28 12:37:43' | ||
} | ||
} | ||
}, | ||
sessionToken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwbGF5ZXJJZCI6IjdhNGU3MGVjLTZlZTYtNDE4ZS05MjNkLWIzYTQ1MDUxYjdmOSIsImFsaWFzSWQiOjEsImlhdCI6MTcxOTU5Mjk3Nn0.gb4-IA_fsDcXOnS3PkQp1eBqwYBaYWiHEmjlqXfd078' | ||
} | ||
} | ||
] | ||
}, | ||
login: { | ||
description: 'Login to a player account', | ||
params: { | ||
body: { | ||
identifier: 'The unique identifier of the player. This can be their username, an email or a numeric ID', | ||
password: 'The player\'s password' | ||
} | ||
}, | ||
samples: [ | ||
{ | ||
title: 'Sample request', | ||
sample: { | ||
identifier: 'boz', | ||
password: 'password' | ||
} | ||
}, | ||
{ | ||
title: 'Sample response (verification not enabled)', | ||
sample: { | ||
alias: { | ||
id: 1, | ||
service: 'talo', | ||
identifier: 'boz', | ||
player: { | ||
id: '7a4e70ec-6ee6-418e-923d-b3a45051b7f9', | ||
props: [], | ||
aliases: [ | ||
'/* [Circular] */' | ||
], | ||
devBuild: false, | ||
createdAt: '2024-06-28 12:37:43', | ||
lastSeenAt: '2024-06-28 12:37:43', | ||
groups: [], | ||
auth: { | ||
email: '[email protected]', | ||
verificationEnabled: true, | ||
sessionCreatedAt: '2024-06-28 12:37:43' | ||
} | ||
} | ||
}, | ||
sessionToken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwbGF5ZXJJZCI6IjdhNGU3MGVjLTZlZTYtNDE4ZS05MjNkLWIzYTQ1MDUxYjdmOSIsImFsaWFzSWQiOjEsImlhdCI6MTcxOTU5Mjk3Nn0.gb4-IA_fsDcXOnS3PkQp1eBqwYBaYWiHEmjlqXfd078' | ||
} | ||
}, | ||
{ | ||
title: 'Sample response (verification enabled)', | ||
sample: { | ||
aliasId: 1, | ||
verificationRequired: true | ||
} | ||
} | ||
] | ||
}, | ||
verify: { | ||
description: 'Provide the verification code to start the player session', | ||
params: { | ||
body: { | ||
aliasId: 'The ID of the alias to verify', | ||
code: 'The 6-digit verification code sent to the player (must be a string)' | ||
} | ||
}, | ||
samples: [ | ||
{ | ||
title: 'Sample request', | ||
sample: { | ||
aliasId: 1, | ||
password: '023251' | ||
} | ||
}, | ||
{ | ||
title: 'Sample response', | ||
sample: { | ||
alias: { | ||
id: 1, | ||
service: 'talo', | ||
identifier: 'boz', | ||
player: { | ||
id: '7a4e70ec-6ee6-418e-923d-b3a45051b7f9', | ||
props: [], | ||
aliases: [ | ||
'/* [Circular] */' | ||
], | ||
devBuild: false, | ||
createdAt: '2024-06-28 12:37:43', | ||
lastSeenAt: '2024-06-28 12:37:43', | ||
groups: [], | ||
auth: { | ||
email: '[email protected]', | ||
verificationEnabled: true, | ||
sessionCreatedAt: '2024-06-28 12:37:43' | ||
} | ||
} | ||
}, | ||
sessionToken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwbGF5ZXJJZCI6IjdhNGU3MGVjLTZlZTYtNDE4ZS05MjNkLWIzYTQ1MDUxYjdmOSIsImFsaWFzSWQiOjEsImlhdCI6MTcxOTU5Mjk3Nn0.gb4-IA_fsDcXOnS3PkQp1eBqwYBaYWiHEmjlqXfd078' | ||
} | ||
} | ||
] | ||
}, | ||
logout: { | ||
description: 'Logout of a player account (and invalidate the session token)', | ||
params: { | ||
headers: { | ||
'x-talo-player': 'The ID of the player', | ||
'x-talo-alias': 'The ID of the player\'s alias', | ||
'x-talo-session': 'The session token' | ||
} | ||
} | ||
}, | ||
changePassword: { | ||
description: 'Change the password of a player account', | ||
params: { | ||
headers: { | ||
'x-talo-player': 'The ID of the player', | ||
'x-talo-alias': 'The ID of the player\'s alias', | ||
'x-talo-session': 'The session token' | ||
}, | ||
body: { | ||
currentPassword: 'The current password of the player', | ||
newPassword: 'The new password for the player' | ||
} | ||
}, | ||
samples: [ | ||
{ | ||
title: 'Sample request', | ||
sample: { | ||
currentPassword: 'password', | ||
newPassword: 'new_password' | ||
} | ||
} | ||
] | ||
}, | ||
changeEmail: { | ||
description: 'Change the email address of a player account', | ||
params: { | ||
headers: { | ||
'x-talo-player': 'The ID of the player', | ||
'x-talo-alias': 'The ID of the player\'s alias', | ||
'x-talo-session': 'The session token' | ||
}, | ||
body: { | ||
currentPassword: 'The current password of the player', | ||
newEmail: 'The new email address for the player' | ||
} | ||
}, | ||
samples: [ | ||
{ | ||
title: 'Sample request', | ||
sample: { | ||
currentPassword: 'password', | ||
newEmail: '[email protected]' | ||
} | ||
} | ||
] | ||
}, | ||
forgotPassword: { | ||
description: 'Send a password reset email to an email address', | ||
params: { | ||
body: { | ||
email: 'The email address to send the verification code to. If no player with this email exists, the request will be ignored' | ||
} | ||
}, | ||
samples: [ | ||
{ | ||
title: 'Sample request', | ||
sample: { | ||
email: '[email protected]' | ||
} | ||
} | ||
] | ||
}, | ||
resetPassword: { | ||
description: 'Reset the password of a player account (invalidates any existing session tokens)', | ||
params: { | ||
body: { | ||
code: 'The 6-digit verification code sent to the email address (must be a string)', | ||
password: 'The new password for the player' | ||
} | ||
}, | ||
samples: [ | ||
{ | ||
title: 'Sample request', | ||
sample: { | ||
code: '642230', | ||
password: 'new_password' | ||
} | ||
} | ||
] | ||
} | ||
} | ||
|
||
export default PlayerAuthAPIDocs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import PlayerAlias from '../entities/player-alias' | ||
import Mail from './mail' | ||
|
||
export default class PlayerAuthCode extends Mail { | ||
constructor(alias: PlayerAlias, code: string) { | ||
super(alias.player.auth.email, `Your ${alias.player.game.name} verification code`, `Hi ${alias.identifier}, here's your verification code to login to ${alias.player.game.name}.`) | ||
|
||
this.title = `Login to ${alias.player.game.name}` | ||
this.mainText = `Hi ${alias.identifier}, your verification code is: <strong>${code}</strong>.<br/>This code is only valid for 5 minutes.` | ||
|
||
this.footer = 'Didn\'t request a code?' | ||
this.footerText = 'Your account is still secure, however, you should update your password as soon as possible.' | ||
|
||
this.why = `You are receiving this email because you enabled email verification for your ${alias.player.game.name} account` | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import PlayerAlias from '../entities/player-alias' | ||
import Mail from './mail' | ||
|
||
export default class PlayerAuthResetPassword extends Mail { | ||
constructor(alias: PlayerAlias, code: string) { | ||
super(alias.player.auth.email, `Reset your ${alias.player.game.name} password`, `Hi ${alias.identifier}. A password reset was requested for your account. If you didn't request this you can safely ignore this email.`) | ||
|
||
this.title = 'Reset your password' | ||
this.mainText = `Hi ${alias.identifier}, a password reset requested was created for your ${alias.player.game.name} account.<br/><br/>Your reset code is: <strong>${code}</strong>.<br/>This code is only valid for 15 minutes.` | ||
|
||
this.footer = 'Didn\'t request a code?' | ||
this.footerText = 'Your account is still secure and you can safely ignore this email.' | ||
|
||
this.why = `You are receiving this email because your ${alias.player.game.name} account is associated with this email address` | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.