switched responsibilities

moved the Open Acces point code to the  rest API because we dont wish to change setting during boot. (other issues arise now eg: what to do when someone changes his wifi password? box does nog connect but also does not open AP)
This commit is contained in:
olijf 2016-03-30 11:10:44 +02:00
parent fa91ace160
commit c6b01a3cf7
3 changed files with 4 additions and 7 deletions

View File

@ -386,11 +386,7 @@ function M.associateSsid(ssid, passphrase, recreate)
if attempt >= maxAttempts then
-- still no correct ssid; fail
local msg = "Could not associate with network (incorrect password?)"
wifi.removeConfig(ssid)
M.setStatus(M.CONNECTING_FAILED,msg);
local backupssid = wifi.getSubstitutedSsid(settings.get('network.ap.ssid'))
M.setupAccessPoint(backupssid)
M.enableAccessPoint(backupssid)
return false, msg
else
nextAttemptTime = os.time() + attemptInterval

View File

@ -182,9 +182,6 @@ function M.removeConfig(ssid)
log:info(MOD_ABBR, "deleting faulty ssid: "..utils.dump(s['.name']))
rv = uci:delete('wireless', s['.name'])
end
if s.disabled == 1 then
M.activateConfig(s.ssid)
end
end)
uci:save('wireless')
uci:commit('wireless')

View File

@ -154,6 +154,10 @@ function M.associate_POST(request, response)
log:info(MOD_ABBR, "associated to wifi: "..utils.dump(argSsid))
else
log:info(MOD_ABBR, "failed to associate to wifi: "..utils.dump(argSsid).." ("..utils.dump(msg)..")")
local backupssid = wifi.getSubstitutedSsid(settings.get('network.ap.ssid'))
netconf.setupAccessPoint(backupssid)
netconf.enableAccessPoint(backupssid)
wifi.removeConfig(argSsid)
end
end