예제 #1
0
파일: devapi.go 프로젝트: coddo/gost
// ActivateAppUser is an endpoint for activating an app user
func (v *DevAPI) ActivateAppUser(params *api.Request) api.Response {
	var token, found = filter.GetStringParameter("token", params.Form)
	if !found {
		return api.BadRequest(api.ErrInvalidInput)
	}

	var err = auth.ActivateAppUser(token)
	if err != nil {
		return api.BadRequest(err)
	}

	return api.PlainTextResponse(http.StatusOK, "Account is now active")
}
예제 #2
0
파일: authapi.go 프로젝트: coddo/gost
// ActivateAccount activates an account using the activation token sent through email
func (a *AuthAPI) ActivateAccount(params *api.Request) api.Response {
	var model = ActivateAccountModel{}

	var err = util.DeserializeJSON(params.Body, &model)
	if err != nil {
		return api.BadRequest(api.ErrEntityFormat)
	}

	err = auth.ActivateAppUser(model.Token)
	if err != nil {
		return api.BadRequest(err)
	}

	return api.StatusResponse(http.StatusOK)
}