예제 #1
0
func (s *AuthSuite) deleteTests(user t.TestUser, c *gc.C) error {
	err := auth.DeleteUser(s.d, user.Email)
	if err != nil {
		return err
	}

	err = auth.Valid(s.d, user.Email, util.Key(user.LoginKey))
	c.Assert(err, gc.ErrorMatches, fmt.Sprintf("user %q not logged in user not found", user.Email))
	return nil
}
예제 #2
0
파일: auth.go 프로젝트: kamaln7/mf-proto
func handleDelete(d db.DB) htr.Handle {
	return func(w http.ResponseWriter, r *http.Request, ps htr.Params) {
		err := r.ParseForm()
		if err != nil {
			WriteResponse(w, newApiError(err.Error(), err))
			log.Error("bad request: %#v", r)
			return
		}
		email := r.Form.Get("email")

		err = auth.DeleteUser(d, email)
		if err != nil {
			WriteResponse(w, newApiError(err.Error(), err))
			log.Error("error deleting user %q: %s", email, err.Error())
			return
		}

		log.Info("user %q deleted", email)
		WriteResponse(w, &auth.User{
			Email: email,
		})
	}
}
예제 #3
0
func (s *AuthSuite) deleteUsers(c *gc.C) {
	for _, u := range s.users {
		err := auth.DeleteUser(s.d, u.Email)
		c.Assert(err, gc.IsNil)
	}
}