From 595ad8fec29f23d036e4e2fb6e30534b3b811cb0 Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Tue, 16 Jul 2019 15:45:40 +0100 Subject: [PATCH] Prevent duplicate entries in the completed registration flows --- clientapi/routing/register.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/clientapi/routing/register.go b/clientapi/routing/register.go index 243f9dd23..fa15f4fc0 100644 --- a/clientapi/routing/register.go +++ b/clientapi/routing/register.go @@ -85,6 +85,12 @@ func (d sessionsDict) GetCompletedStages(sessionID string) []authtypes.LoginType // AddCompletedStage records that a session has completed an auth stage. func (d *sessionsDict) AddCompletedStage(sessionID string, stage authtypes.LoginType) { + // Return if the stage is already present + for _, completedStage := range d.GetCompletedStages(sessionID) { + if completedStage == stage { + return + } + } d.sessions[sessionID] = append(d.GetCompletedStages(sessionID), stage) }