mirror of
https://github.com/openziti/zrok.git
synced 2024-12-01 04:23:59 +01:00
not public; lint
This commit is contained in:
parent
4b3c22d02a
commit
cb1a88e339
@ -27,12 +27,12 @@ func createAccountHandler(params identity.CreateAccountParams) middleware.Respon
|
|||||||
Password: hashPassword(params.Body.Password),
|
Password: hashPassword(params.Body.Password),
|
||||||
Token: token,
|
Token: token,
|
||||||
}
|
}
|
||||||
tx, err := Str.Begin()
|
tx, err := str.Begin()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Errorf("error starting transaction: %v", err)
|
logrus.Errorf("error starting transaction: %v", err)
|
||||||
return identity.NewCreateAccountInternalServerError().WithPayload(rest_model_zrok.ErrorMessage(err.Error()))
|
return identity.NewCreateAccountInternalServerError().WithPayload(rest_model_zrok.ErrorMessage(err.Error()))
|
||||||
}
|
}
|
||||||
id, err := Str.CreateAccount(a, tx)
|
id, err := str.CreateAccount(a, tx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Errorf("error creating account: %v", err)
|
logrus.Errorf("error creating account: %v", err)
|
||||||
_ = tx.Rollback()
|
_ = tx.Rollback()
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
var Str *store.Store
|
var str *store.Store
|
||||||
|
|
||||||
func Run(cfg *Config) error {
|
func Run(cfg *Config) error {
|
||||||
swaggerSpec, err := loads.Embedded(rest_server_zrok.SwaggerJSON, rest_server_zrok.FlatSwaggerJSON)
|
swaggerSpec, err := loads.Embedded(rest_server_zrok.SwaggerJSON, rest_server_zrok.FlatSwaggerJSON)
|
||||||
@ -29,7 +29,7 @@ func Run(cfg *Config) error {
|
|||||||
api.TunnelUntunnelHandler = tunnel.UntunnelHandlerFunc(untunnelHandler)
|
api.TunnelUntunnelHandler = tunnel.UntunnelHandlerFunc(untunnelHandler)
|
||||||
|
|
||||||
if v, err := store.Open(cfg.Store); err == nil {
|
if v, err := store.Open(cfg.Store); err == nil {
|
||||||
Str = v
|
str = v
|
||||||
} else {
|
} else {
|
||||||
return errors.Wrap(err, "error opening store")
|
return errors.Wrap(err, "error opening store")
|
||||||
}
|
}
|
||||||
|
@ -14,11 +14,11 @@ import (
|
|||||||
|
|
||||||
func ZrokAuthenticate(token string) (*rest_model_zrok.Principal, error) {
|
func ZrokAuthenticate(token string) (*rest_model_zrok.Principal, error) {
|
||||||
logrus.Infof("authenticating")
|
logrus.Infof("authenticating")
|
||||||
tx, err := Str.Begin()
|
tx, err := str.Begin()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if a, err := Str.FindAccountWithToken(token, tx); err == nil {
|
if a, err := str.FindAccountWithToken(token, tx); err == nil {
|
||||||
principal := rest_model_zrok.Principal{
|
principal := rest_model_zrok.Principal{
|
||||||
ID: int64(a.Id),
|
ID: int64(a.Id),
|
||||||
Token: a.Token,
|
Token: a.Token,
|
||||||
|
Loading…
Reference in New Issue
Block a user