fix(oidc): request object reference in oidc signup

The request object was not being passed to OIDC signup because it is
called by createUserFromOIDC which doesn't take a request object as a
parameter. It was decided to have `create_user` take the request object
from context if it's not specified rather than change the signature of
createUserFromOIDC.
This commit is contained in:
KernelDeimos
2026-03-04 14:04:02 -05:00
committed by Eric Dubé
parent 1720c97851
commit fc29e57730
@@ -2,6 +2,7 @@
import bcrypt from 'bcrypt';
import { v4 as uuidv4 } from 'uuid';
import { generate_random_username, send_email_verification_code, send_email_verification_token, username_exists } from '../../helpers.js';
import { Context } from '../../util/context.js';
import { OutcomeObject } from '../../util/outcomeutil.js';
import { validate_nonEmpty_string } from '../../util/validutil.js';
import BaseService from '../BaseService.js';
@@ -19,7 +20,9 @@ export class SignupService extends BaseService {
* Creates a new user.
* @async
* @param {object} params - The parameters for creating a new user.
* @param {object} [params.req] - The request object (if applicable).
* @param {object} [params.req] - The request object. If not specified,
* the request will be obtained from the context. If specified as null, request
* information will not be included for this signup.
* @param {boolean} [params.temporary] - Whether the user is a temporary user.
* @param {boolean} [params.oidc_only] - Whether the user created with OIDC
* @param {boolean} [params.send_confirmation_code] - Whether to send a confirmation code instead of a token by email
@@ -41,6 +44,10 @@ export class SignupService extends BaseService {
}) {
const outcome = new OutcomeObject(new CreatedUserOutcome());
if ( !req && req !== null ) {
req = Context.get('req');
}
let raw_email = email;
if ( ! username ) {