diff --git a/public/js/pages/Radius/RadiusUsers.js b/public/js/pages/Radius/RadiusUsers.js index a9a5cc108..ef8f55f7b 100644 --- a/public/js/pages/Radius/RadiusUsers.js +++ b/public/js/pages/Radius/RadiusUsers.js @@ -1440,29 +1440,55 @@ Vue.component('radius-users', { }, async runRemoteAccess() { if (!this.routerDevice || !this.routerDevice.deviceId) return; - + this.showRemoteAccessModal = true; this.remoteAccessLoading = true; - this.remoteAccessStep = 'Konfiguriere Parameter...'; + this.remoteAccessStep = 'Lade User Parameter...'; this.remoteAccessResult = null; - + const password = this.generatePassword(12); const timestamp = Math.floor(Date.now() / 1000).toString(); - + try { + // First, refresh User.1 parameters so GenieACS knows about them + const userParams = [ + 'InternetGatewayDevice.User.1.Enable', + 'InternetGatewayDevice.User.1.Password', + 'InternetGatewayDevice.User.1.RemoteAccessCapable', + 'InternetGatewayDevice.User.1.Username' + ]; + + const refreshParamsResponse = await fetch(`${window.TT_CONFIG.BASE_PATH}/Radius/genieacsGetParameters`, { + method: 'POST', + headers: {'Content-Type': 'application/json'}, + body: JSON.stringify({ + deviceId: this.routerDevice.deviceId, + parameters: userParams + }) + }); + + if (!refreshParamsResponse.ok) { + throw new Error("Fehler beim Laden der Parameter"); + } + + // Wait for GenieACS to query the device + await new Promise(resolve => setTimeout(resolve, 3000)); + + // Now set the parameters + this.remoteAccessStep = 'Konfiguriere Parameter...'; const params = { 'InternetGatewayDevice.User.1.Enable': true, 'InternetGatewayDevice.User.1.Password': password, 'InternetGatewayDevice.User.1.RemoteAccessCapable': true, 'InternetGatewayDevice.User.1.Username': timestamp }; - + const success = await this.setParameterValues(params); if (!success) throw new Error("Fehler beim Setzen der Parameter"); - + this.remoteAccessStep = 'Warte auf TR069-User...'; this.pollRemoteUsername(password); - + } catch (e) { this.remoteAccessLoading = false; window.notify('error', e.message);