File tree Expand file tree Collapse file tree
fxa-auth-server/lib/routes
pages/Signin/SigninTotpCode Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1766,6 +1766,7 @@ export default class AuthClient {
17661766 code : string ,
17671767 options : {
17681768 service ?: string ;
1769+ metricsContext ?: MetricsContext ;
17691770 } = { } ,
17701771 headers ?: Headers
17711772 ) {
Original file line number Diff line number Diff line change @@ -491,6 +491,7 @@ module.exports = (
491491 . required ( )
492492 . description ( DESCRIPTION . codeTotp ) ,
493493 service : validators . service ,
494+ metricsContext : METRICS_CONTEXT_SCHEMA
494495 } ) ,
495496 } ,
496497 response : {
Original file line number Diff line number Diff line change @@ -199,10 +199,14 @@ export class AccountResolver {
199199 @Args ( 'input' , { type : ( ) => VerifyTotpInput } )
200200 input : VerifyTotpInput
201201 ) : Promise < VerifyTotpPayload > {
202+ const options = {
203+ service : input . service ,
204+ metricsContext : input . metricsContext ,
205+ } ;
202206 const result = await this . authAPI . verifyTotpCode (
203207 token ,
204208 input . code ,
205- input . service ? { service : input . service } : undefined ,
209+ options ,
206210 headers
207211 ) ;
208212 return {
Original file line number Diff line number Diff line change 22 * License, v. 2.0. If a copy of the MPL was not distributed with this
33 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
44import { Field , InputType } from '@nestjs/graphql' ;
5+ import { MetricsContext } from './metrics-context' ;
56
67@InputType ( )
78export class VerifyTotpInput {
@@ -16,4 +17,7 @@ export class VerifyTotpInput {
1617
1718 @Field ( { nullable : true } )
1819 public service ?: string ;
20+
21+ @Field ( ( ) => MetricsContext , { nullable : true } )
22+ public metricsContext ?: MetricsContext ;
1923}
Original file line number Diff line number Diff line change @@ -522,7 +522,7 @@ const AuthAndAccountSetupRoutes = ({
522522 />
523523 < SigninTotpCodeContainer
524524 path = "/signin_totp_code/*"
525- { ...{ integration, serviceName } }
525+ { ...{ integration, serviceName, flowQueryParams } }
526526 />
527527 < SigninPushCodeContainer
528528 path = "/signin_push_code/*"
Original file line number Diff line number Diff line change @@ -43,15 +43,19 @@ import {
4343import { tryFinalizeUpgrade } from '../../../lib/gql-key-stretch-upgrade' ;
4444import { AuthUiErrors } from '../../../lib/auth-errors/auth-errors' ;
4545import { useNavigateWithQuery } from '../../../lib/hooks/useNavigateWithQuery' ;
46+ import { queryParamsToMetricsContext } from '../../../lib/metrics' ;
47+ import { searchParams } from '../../../lib/utilities' ;
48+ import { QueryParams } from '../../../index' ;
4649
4750export type SigninTotpCodeContainerProps = {
4851 integration : Integration ;
4952 serviceName : MozServices ;
53+ flowQueryParams ?: QueryParams ;
5054} ;
5155
5256export const SigninTotpCodeContainer = ( {
5357 integration,
54- serviceName,
58+ serviceName, flowQueryParams
5559} : SigninTotpCodeContainerProps & RouteComponentProps ) => {
5660 const authClient = useAuthClient ( ) ;
5761 const { finishOAuthFlowHandler, oAuthDataError } = useFinishOAuthFlowHandler (
@@ -105,6 +109,9 @@ export const SigninTotpCodeContainer = ({
105109 input : {
106110 code,
107111 service,
112+ metricsContext : queryParamsToMetricsContext (
113+ flowQueryParams as ReturnType < typeof searchParams >
114+ )
108115 } ,
109116 } ,
110117 update : ( cache , { data } ) => {
You can’t perform that action at this time.
0 commit comments