Browse Source

add user clear

fancl 1 year ago
parent
commit
0cd890fbb0
1 changed files with 9 additions and 0 deletions
  1. 9 0
      entry/http/user.go

+ 9 - 0
entry/http/user.go

@@ -19,3 +19,12 @@ func (ui *Userinfo) Get(k string) string {
 	}
 	return ui.variables[k]
 }
+
+func (ui *Userinfo) Reset(id, name string) {
+	ui.ID = id
+	ui.Name = name
+	// clear the variables
+	for k, _ := range ui.variables {
+		delete(ui.variables, k)
+	}
+}