moved LoginResult in types
This commit is contained in:
parent
f59f3183f2
commit
9cfc4da5f3
@ -13,11 +13,6 @@ import (
|
||||
types "git.kapelle.org/niklas/s3browser/internal/types"
|
||||
)
|
||||
|
||||
type LoginResult struct {
|
||||
Token string `json:"token"`
|
||||
Successful bool `json:"successful"`
|
||||
}
|
||||
|
||||
var graphqlDirType *graphql.Object
|
||||
var graphqlFileType *graphql.Object
|
||||
var graphqlLoginResultType *graphql.Object
|
||||
|
@ -194,11 +194,11 @@ func deleteDirectory(ctx context.Context, path string) error {
|
||||
}
|
||||
|
||||
//login Checks for valid username password combination. Returns singed jwt string
|
||||
func login(ctx context.Context, username, password string) (LoginResult, error) {
|
||||
func login(ctx context.Context, username, password string) (types.LoginResult, error) {
|
||||
|
||||
// TODO: replace with propper user management
|
||||
if username != "admin" && password != "hunter2" {
|
||||
return LoginResult{
|
||||
return types.LoginResult{
|
||||
Successful: false,
|
||||
}, nil
|
||||
}
|
||||
@ -208,12 +208,12 @@ func login(ctx context.Context, username, password string) (LoginResult, error)
|
||||
tokenString, err := token.SignedString([]byte("TODO"))
|
||||
|
||||
if err != nil {
|
||||
return LoginResult{
|
||||
return types.LoginResult{
|
||||
Successful: false,
|
||||
}, err
|
||||
}
|
||||
|
||||
return LoginResult{
|
||||
return types.LoginResult{
|
||||
Token: tokenString,
|
||||
Successful: true,
|
||||
}, nil
|
||||
|
@ -40,3 +40,8 @@ type Directory struct {
|
||||
type JWTClaims struct {
|
||||
jwt.StandardClaims
|
||||
}
|
||||
|
||||
type LoginResult struct {
|
||||
Token string `json:"token"`
|
||||
Successful bool `json:"successful"`
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user