@@ -1530,7 +1530,7 @@ function initU2FAuth() {
15301530 }
15311531 u2fApi . ensureSupport ( )
15321532 . then ( function ( ) {
1533- $ . getJSON ( '/user/u2f/challenge' ) . success ( function ( req ) {
1533+ $ . getJSON ( suburl + '/user/u2f/challenge' ) . success ( function ( req ) {
15341534 u2fApi . sign ( req . appId , req . challenge , req . registeredKeys , 30 )
15351535 . then ( u2fSigned )
15361536 . catch ( function ( err ) {
@@ -1543,16 +1543,16 @@ function initU2FAuth() {
15431543 } ) ;
15441544 } ) . catch ( function ( ) {
15451545 // Fallback in case browser do not support U2F
1546- window . location . href = "/user/two_factor"
1546+ window . location . href = suburl + "/user/two_factor"
15471547 } )
15481548}
15491549function u2fSigned ( resp ) {
15501550 $ . ajax ( {
1551- url :'/user/u2f/sign' ,
1552- type :"POST" ,
1551+ url : suburl + '/user/u2f/sign' ,
1552+ type : "POST" ,
15531553 headers : { "X-Csrf-Token" : csrf } ,
15541554 data : JSON . stringify ( resp ) ,
1555- contentType :"application/json; charset=utf-8" ,
1555+ contentType : "application/json; charset=utf-8" ,
15561556 } ) . done ( function ( res ) {
15571557 window . location . replace ( res ) ;
15581558 } ) . fail ( function ( xhr , textStatus ) {
@@ -1565,11 +1565,11 @@ function u2fRegistered(resp) {
15651565 return ;
15661566 }
15671567 $ . ajax ( {
1568- url :'/user/settings/security/u2f/register' ,
1569- type :"POST" ,
1568+ url : suburl + '/user/settings/security/u2f/register' ,
1569+ type : "POST" ,
15701570 headers : { "X-Csrf-Token" : csrf } ,
15711571 data : JSON . stringify ( resp ) ,
1572- contentType :"application/json; charset=utf-8" ,
1572+ contentType : "application/json; charset=utf-8" ,
15731573 success : function ( ) {
15741574 window . location . reload ( ) ;
15751575 } ,
@@ -1623,7 +1623,7 @@ function initU2FRegister() {
16231623}
16241624
16251625function u2fRegisterRequest ( ) {
1626- $ . post ( "/user/settings/security/u2f/request_register" , {
1626+ $ . post ( suburl + "/user/settings/security/u2f/request_register" , {
16271627 "_csrf" : csrf ,
16281628 "name" : $ ( '#nickname' ) . val ( )
16291629 } ) . success ( function ( req ) {
0 commit comments