-
-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fix] Fixed failing build and renamed Login to LoginComponent #604
Fixes #604
- Loading branch information
1 parent
d1f2772
commit 88cc7b7
Showing
4 changed files
with
46 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,27 @@ | ||
function _getParam(name) { | ||
if (name = (new RegExp("[?&]" + encodeURIComponent(name) + "=([^&]*)")).exec(location.search)) | ||
return decodeURIComponent(name[1]); | ||
} | ||
export default function handleCaptivePortalLogin(captivePortalLoginForm, setCaptivePortalError) { | ||
const res = _getParam("res"); | ||
const reply = _getParam("reply"); | ||
if (res === "failed" && reply) { | ||
setCaptivePortalError({ | ||
type: "authError", | ||
message: reply, | ||
}); | ||
} else { | ||
setCaptivePortalError(null); | ||
} | ||
const getUrlParam = (paramName) => { | ||
const searchRegex = new RegExp( | ||
`[?&]${encodeURIComponent(paramName)}=([^&]*)`, | ||
); | ||
const match = searchRegex.exec(window.location.search); | ||
if (match) { | ||
return decodeURIComponent(match[1]); | ||
} | ||
return null; | ||
}; | ||
|
||
export default function handleCaptivePortalLogin( | ||
captivePortalLoginForm, | ||
setCaptivePortalError, | ||
) { | ||
const res = getUrlParam("res"); | ||
const reply = getUrlParam("reply"); | ||
|
||
if (res === "failed" && reply) { | ||
setCaptivePortalError({ | ||
type: "authError", | ||
message: reply, | ||
}); | ||
} else { | ||
setCaptivePortalError(null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters