Skip to content
Snippets Groups Projects
Commit bf28be98 authored by Odin K. Henriksen's avatar Odin K. Henriksen
Browse files

Escalate to manual analysis

parent d0a36747
No related branches found
No related tags found
1 merge request!2Merge react-branch into main.
...@@ -161,17 +161,16 @@ func main() { ...@@ -161,17 +161,16 @@ func main() {
url := c.Query("url") url := c.Query("url")
result := c.Query("result") result := c.Query("result")
api.EscalateAnalysis(url, result, token) //api.EscalateAnalysis(url, result, token)
/**authenticated, _ := auth.Authenticate("", token) authenticated, _ := auth.Authenticate("", token)
if !authenticated { if !authenticated {
c.JSON(http.StatusUnauthorized, gin.H{"authenticated": "You are not authenticated. User login is invalid."}) c.JSON(http.StatusUnauthorized, gin.H{"authenticated": "You are not authenticated. User login is invalid."})
} else { } else {
api.EscalateAnalysis(url, result, token) api.EscalateAnalysis(url, result, token)
c.JSON(http.StatusOK, nil) c.JSON(http.StatusOK, nil)
} }
*/
}) })
log.Fatal(r.Run(":8081")) log.Fatal(r.Run(":8081"))
......
...@@ -146,9 +146,7 @@ function Result() { ...@@ -146,9 +146,7 @@ function Result() {
{isLoading ? <Oval height="100" width="100" color="grey"/> : renderResult} {isLoading ? <Oval height="100" width="100" color="grey"/> : renderResult}
</div> </div>
<div className= "container w-full mb-3 sm:pl-36 sm:pr-36 flex justify-center overflow-hidden"> <div className= "container w-full mb-3 sm:pl-36 sm:pr-36 flex justify-center overflow-hidden">
<a href="./investigate"> <button onClick={() => EscalateAnalysis(url, userAuth)} className="bg-orange-500 p-2 rounded justify-center">{t("manualAnalysisBtn")}</button>
<button className="bg-orange-500 p-2 rounded justify-center">{t("manualAnalysisBtn")}</button>
</a>
</div> </div>
<CookieDisclosure /> <CookieDisclosure />
...@@ -157,4 +155,24 @@ function Result() { ...@@ -157,4 +155,24 @@ function Result() {
); );
} }
function EscalateAnalysis(url, userAuth){
fetch(process.env.REACT_APP_BACKEND_URL+'/escalate?url=' + url +"&result=" + window.location.href + "&userAuth=" + userAuth, {
method: 'GET',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json'
}
}).then((response) => response.json())
.then((json) => {
// If the authentication response is invalid remove the authentication
// locally and redirect to the login page.
if (json.authenticated !== undefined){
localStorage.removeItem('userAuth')
window.location.href="/login"
}
})
window.alert("An email has been sent informing you about the escalation to manual analysis, futher contact will be made by email")
}
export default Result; export default Result;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment