generated from VLADIMIR/template
fix login
This commit is contained in:
@@ -8,8 +8,9 @@ import (
|
||||
|
||||
func mapTeamsToTeamAdvanced(team *models.Team) *proto.TeamAdvanced {
|
||||
return &proto.TeamAdvanced{
|
||||
Id: team.ID,
|
||||
Name: team.Name,
|
||||
Id: team.ID,
|
||||
Name: team.Name,
|
||||
Password: team.Password,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,11 +30,6 @@ func NewRepository() (*Repository, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// for tests
|
||||
// _, err = db.Exec("insert into teams (id, name, password) values (1, \"name\", \"pass\");")
|
||||
// if err != nil {
|
||||
// return nil, err
|
||||
// }
|
||||
return &Repository{db: db}, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package services
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"evening_detective/internal/models"
|
||||
"evening_detective/internal/modules/password"
|
||||
@@ -96,7 +97,10 @@ func (s *Services) GetTeam(ctx context.Context, req *proto.GetTeamReq) (*proto.G
|
||||
}
|
||||
res = append(res, newAction)
|
||||
}
|
||||
return &proto.GetTeamRsp{Actions: res}, err
|
||||
return &proto.GetTeamRsp{
|
||||
Name: team.Name,
|
||||
Actions: res,
|
||||
}, err
|
||||
}
|
||||
|
||||
func (s *Services) GetTeamsCSV(ctx context.Context, req *proto.GetTeamsCSVReq) (*proto.GetTeamsCSVRsp, error) {
|
||||
@@ -154,7 +158,10 @@ func (s *Services) getTeam(ctx context.Context) (*models.Team, error) {
|
||||
if !ok {
|
||||
return nil, status.Errorf(codes.Unauthenticated, "error creds")
|
||||
}
|
||||
teamId := teamIdArr[0]
|
||||
teamId, err := base64.StdEncoding.DecodeString(teamIdArr[0])
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Unauthenticated, "error creds")
|
||||
}
|
||||
|
||||
passwordArr, ok := md["password"]
|
||||
if !ok {
|
||||
|
||||
Reference in New Issue
Block a user