aboutsummaryrefslogtreecommitdiff
path: root/clientapi/routing/register.go
diff options
context:
space:
mode:
authorAndrew Morgan <1342360+anoadragon453@users.noreply.github.com>2019-07-17 04:55:25 +0100
committerAlex Chen <Cnly@users.noreply.github.com>2019-07-17 11:55:25 +0800
commitbff60953f36f87706546e49cd38fd7fc93727efa (patch)
tree6fb53015b9439926e585547bf5098398d1be380d /clientapi/routing/register.go
parentc494d81235725957e7c7b55a2f798cf345266b47 (diff)
Prevent duplicate entries in the completed registration flows (#741)
Diffstat (limited to 'clientapi/routing/register.go')
-rw-r--r--clientapi/routing/register.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/clientapi/routing/register.go b/clientapi/routing/register.go
index 243f9dd2..fa15f4fc 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)
}