mirror of
https://github.com/smogon/pokemon-showdown-loginserver.git
synced 2026-04-26 01:31:42 -05:00
OAuth: Ensure the getassertion action accepts a challstr properly
This commit is contained in:
parent
2b22a33bb3
commit
77ddb1cd17
|
|
@ -595,14 +595,19 @@ export const actions: {[k: string]: QueryHandler} = {
|
|||
if (!token) {
|
||||
throw new ActionError('No token provided.');
|
||||
}
|
||||
const challstr = params.challenge || params.challstr;
|
||||
if (!challstr) {
|
||||
throw new ActionError('No challstr provided.');
|
||||
}
|
||||
const tokenEntry = await (
|
||||
tables.oauthTokens.selectOne()
|
||||
)`WHERE owner = ${this.user.id} and client = ${client.id}`;
|
||||
if (!tokenEntry || tokenEntry.id !== token) {
|
||||
return {success: false};
|
||||
}
|
||||
const challstr = crypto.randomBytes(20).toString('hex');
|
||||
return this.session.getAssertion(tokenEntry.owner, Config.challengekeyid, this.user, challstr);
|
||||
return this.session.getAssertion(
|
||||
tokenEntry.owner, Config.challengekeyid, this.user, challstr
|
||||
);
|
||||
},
|
||||
|
||||
'oauth/authorized'() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user