diff --git a/api/main.proto b/api/main.proto index b8ab5ec..3706e6c 100644 --- a/api/main.proto +++ b/api/main.proto @@ -31,6 +31,13 @@ service EveningDetectiveServer { body: "*" }; } + + rpc Login(LoginReq) returns (LoginRsp) { + option (google.api.http) = { + post: "/api/login" + body: "*" + }; + } } message PingReq {} @@ -61,3 +68,14 @@ message RefreshPasswordReq { message RefreshPasswordRsp { string error = 1; } + +message LoginReq { + string email = 1; + string password = 2; +} + +message LoginRsp { + string error = 1; + string accessToken = 2; + string refreshToken = 3; +} diff --git a/cmd/evening_detective_server/main.swagger.json b/cmd/evening_detective_server/main.swagger.json index 18049e0..bcd372e 100644 --- a/cmd/evening_detective_server/main.swagger.json +++ b/cmd/evening_detective_server/main.swagger.json @@ -46,6 +46,38 @@ ] } }, + "/api/login": { + "post": { + "operationId": "EveningDetectiveServer_Login", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/evening_detective_serverLoginRsp" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/evening_detective_serverLoginReq" + } + } + ], + "tags": [ + "EveningDetectiveServer" + ] + } + }, "/api/ping": { "get": { "operationId": "EveningDetectiveServer_Ping", @@ -142,6 +174,31 @@ } } }, + "evening_detective_serverLoginReq": { + "type": "object", + "properties": { + "email": { + "type": "string" + }, + "password": { + "type": "string" + } + } + }, + "evening_detective_serverLoginRsp": { + "type": "object", + "properties": { + "error": { + "type": "string" + }, + "accessToken": { + "type": "string" + }, + "refreshToken": { + "type": "string" + } + } + }, "evening_detective_serverPingRsp": { "type": "object" }, diff --git a/internal/app/server.go b/internal/app/server.go index 019796e..90c27ab 100644 --- a/internal/app/server.go +++ b/internal/app/server.go @@ -47,3 +47,13 @@ func (s *server) RefreshPassword(ctx context.Context, req *proto.RefreshPassword } return &proto.RefreshPasswordRsp{}, nil } + +func (s *server) Login(ctx context.Context, req *proto.LoginReq) (*proto.LoginRsp, error) { + err := s.usersService.Login(ctx, req.Email, req.Password) + if err != nil { + return &proto.LoginRsp{ + Error: err.Error(), + }, nil + } + return &proto.LoginRsp{}, nil +} diff --git a/internal/repos/user.go b/internal/repos/user.go index c065db0..a3cbf82 100644 --- a/internal/repos/user.go +++ b/internal/repos/user.go @@ -1,6 +1,10 @@ package repos type User struct { - Username string - Email string + ID string + Username string + Email string + PasswordHash string + Role string + IsActive bool } diff --git a/internal/repos/users_repo/repo.go b/internal/repos/users_repo/repo.go index 0150016..dd2a39d 100644 --- a/internal/repos/users_repo/repo.go +++ b/internal/repos/users_repo/repo.go @@ -3,7 +3,9 @@ package users_repo import ( "context" "errors" + "evening_detective_server/internal/repos" + "github.com/jackc/pgx/v5" "github.com/jackc/pgx/v5/pgxpool" ) @@ -75,3 +77,33 @@ func (s *UsersRepo) UpdateUserPassword( return nil } + +func (s *UsersRepo) GetUserByEmail( + ctx context.Context, + email string, +) (*repos.User, error) { + user := &repos.User{} + row := s.pool.QueryRow( + ctx, + `SELECT id, username, email, password_hash, role, is_active + FROM users + WHERE email = $1`, + email, + ) + err := row.Scan( + &user.ID, + &user.Username, + &user.Email, + &user.PasswordHash, + &user.Role, + &user.IsActive, + ) + if err != nil { + if errors.Is(err, pgx.ErrNoRows) { + return nil, ErrUserNotFound + } + return nil, err + } + + return user, nil +} diff --git a/internal/services/users_service/service.go b/internal/services/users_service/service.go index c84a67b..cabcf9e 100644 --- a/internal/services/users_service/service.go +++ b/internal/services/users_service/service.go @@ -2,6 +2,7 @@ package users_service import ( "context" + "errors" "evening_detective_server/internal/modules/email_sender" "evening_detective_server/internal/modules/password_generator" "evening_detective_server/internal/repos/users_repo" @@ -91,3 +92,29 @@ func (s *UsersService) RefreshPassword( return err } + +func (s *UsersService) Login( + ctx context.Context, + email string, + password string, +) error { + user, err := s.usersRepo.GetUserByEmail( + ctx, + email, + ) + if err != nil { + return err + } + + if err = bcrypt.CompareHashAndPassword([]byte(user.PasswordHash), []byte(password)); err != nil { + return errors.New("Не верен email или пароль") + } + + fmt.Println(user, err) + + // gen tokens (module) + + // save refresh token? + + return nil // claims? +} diff --git a/proto/main.pb.go b/proto/main.pb.go index 3a828f0..a189556 100644 --- a/proto/main.pb.go +++ b/proto/main.pb.go @@ -366,6 +366,118 @@ func (x *RefreshPasswordRsp) GetError() string { return "" } +type LoginReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"` + Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LoginReq) Reset() { + *x = LoginReq{} + mi := &file_main_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LoginReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LoginReq) ProtoMessage() {} + +func (x *LoginReq) ProtoReflect() protoreflect.Message { + mi := &file_main_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LoginReq.ProtoReflect.Descriptor instead. +func (*LoginReq) Descriptor() ([]byte, []int) { + return file_main_proto_rawDescGZIP(), []int{8} +} + +func (x *LoginReq) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +func (x *LoginReq) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +type LoginRsp struct { + state protoimpl.MessageState `protogen:"open.v1"` + Error string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` + AccessToken string `protobuf:"bytes,2,opt,name=accessToken,proto3" json:"accessToken,omitempty"` + RefreshToken string `protobuf:"bytes,3,opt,name=refreshToken,proto3" json:"refreshToken,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LoginRsp) Reset() { + *x = LoginRsp{} + mi := &file_main_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LoginRsp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LoginRsp) ProtoMessage() {} + +func (x *LoginRsp) ProtoReflect() protoreflect.Message { + mi := &file_main_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LoginRsp.ProtoReflect.Descriptor instead. +func (*LoginRsp) Descriptor() ([]byte, []int) { + return file_main_proto_rawDescGZIP(), []int{9} +} + +func (x *LoginRsp) GetError() string { + if x != nil { + return x.Error + } + return "" +} + +func (x *LoginRsp) GetAccessToken() string { + if x != nil { + return x.AccessToken + } + return "" +} + +func (x *LoginRsp) GetRefreshToken() string { + if x != nil { + return x.RefreshToken + } + return "" +} + var File_main_proto protoreflect.FileDescriptor const file_main_proto_rawDesc = "" + @@ -386,12 +498,21 @@ const file_main_proto_rawDesc = "" + "\x12RefreshPasswordReq\x12\x14\n" + "\x05email\x18\x01 \x01(\tR\x05email\"*\n" + "\x12RefreshPasswordRsp\x12\x14\n" + - "\x05error\x18\x01 \x01(\tR\x05error2\x88\x04\n" + + "\x05error\x18\x01 \x01(\tR\x05error\"<\n" + + "\bLoginReq\x12\x14\n" + + "\x05email\x18\x01 \x01(\tR\x05email\x12\x1a\n" + + "\bpassword\x18\x02 \x01(\tR\bpassword\"f\n" + + "\bLoginRsp\x12\x14\n" + + "\x05error\x18\x01 \x01(\tR\x05error\x12 \n" + + "\vaccessToken\x18\x02 \x01(\tR\vaccessToken\x12\"\n" + + "\frefreshToken\x18\x03 \x01(\tR\frefreshToken2\xfc\x04\n" + "\x16EveningDetectiveServer\x12k\n" + "\x04Ping\x12'.crabs.evening_detective_server.PingReq\x1a'.crabs.evening_detective_server.PingRsp\"\x11\x82\xd3\xe4\x93\x02\v\x12\t/api/ping\x12k\n" + "\x04Echo\x12'.crabs.evening_detective_server.EchoReq\x1a'.crabs.evening_detective_server.EchoRsp\"\x11\x82\xd3\xe4\x93\x02\v\"\t/api/echo\x12v\n" + "\x06Signup\x12).crabs.evening_detective_server.SignupReq\x1a).crabs.evening_detective_server.SignupRsp\"\x16\x82\xd3\xe4\x93\x02\x10:\x01*\"\v/api/signup\x12\x9b\x01\n" + - "\x0fRefreshPassword\x122.crabs.evening_detective_server.RefreshPasswordReq\x1a2.crabs.evening_detective_server.RefreshPasswordRsp\" \x82\xd3\xe4\x93\x02\x1a:\x01*\"\x15/api/refresh-passwordB\vZ\tpkg/protob\x06proto3" + "\x0fRefreshPassword\x122.crabs.evening_detective_server.RefreshPasswordReq\x1a2.crabs.evening_detective_server.RefreshPasswordRsp\" \x82\xd3\xe4\x93\x02\x1a:\x01*\"\x15/api/refresh-password\x12r\n" + + "\x05Login\x12(.crabs.evening_detective_server.LoginReq\x1a(.crabs.evening_detective_server.LoginRsp\"\x15\x82\xd3\xe4\x93\x02\x0f:\x01*\"\n" + + "/api/loginB\vZ\tpkg/protob\x06proto3" var ( file_main_proto_rawDescOnce sync.Once @@ -405,7 +526,7 @@ func file_main_proto_rawDescGZIP() []byte { return file_main_proto_rawDescData } -var file_main_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_main_proto_msgTypes = make([]protoimpl.MessageInfo, 10) var file_main_proto_goTypes = []any{ (*PingReq)(nil), // 0: crabs.evening_detective_server.PingReq (*PingRsp)(nil), // 1: crabs.evening_detective_server.PingRsp @@ -415,18 +536,22 @@ var file_main_proto_goTypes = []any{ (*SignupRsp)(nil), // 5: crabs.evening_detective_server.SignupRsp (*RefreshPasswordReq)(nil), // 6: crabs.evening_detective_server.RefreshPasswordReq (*RefreshPasswordRsp)(nil), // 7: crabs.evening_detective_server.RefreshPasswordRsp + (*LoginReq)(nil), // 8: crabs.evening_detective_server.LoginReq + (*LoginRsp)(nil), // 9: crabs.evening_detective_server.LoginRsp } var file_main_proto_depIdxs = []int32{ 0, // 0: crabs.evening_detective_server.EveningDetectiveServer.Ping:input_type -> crabs.evening_detective_server.PingReq 2, // 1: crabs.evening_detective_server.EveningDetectiveServer.Echo:input_type -> crabs.evening_detective_server.EchoReq 4, // 2: crabs.evening_detective_server.EveningDetectiveServer.Signup:input_type -> crabs.evening_detective_server.SignupReq 6, // 3: crabs.evening_detective_server.EveningDetectiveServer.RefreshPassword:input_type -> crabs.evening_detective_server.RefreshPasswordReq - 1, // 4: crabs.evening_detective_server.EveningDetectiveServer.Ping:output_type -> crabs.evening_detective_server.PingRsp - 3, // 5: crabs.evening_detective_server.EveningDetectiveServer.Echo:output_type -> crabs.evening_detective_server.EchoRsp - 5, // 6: crabs.evening_detective_server.EveningDetectiveServer.Signup:output_type -> crabs.evening_detective_server.SignupRsp - 7, // 7: crabs.evening_detective_server.EveningDetectiveServer.RefreshPassword:output_type -> crabs.evening_detective_server.RefreshPasswordRsp - 4, // [4:8] is the sub-list for method output_type - 0, // [0:4] is the sub-list for method input_type + 8, // 4: crabs.evening_detective_server.EveningDetectiveServer.Login:input_type -> crabs.evening_detective_server.LoginReq + 1, // 5: crabs.evening_detective_server.EveningDetectiveServer.Ping:output_type -> crabs.evening_detective_server.PingRsp + 3, // 6: crabs.evening_detective_server.EveningDetectiveServer.Echo:output_type -> crabs.evening_detective_server.EchoRsp + 5, // 7: crabs.evening_detective_server.EveningDetectiveServer.Signup:output_type -> crabs.evening_detective_server.SignupRsp + 7, // 8: crabs.evening_detective_server.EveningDetectiveServer.RefreshPassword:output_type -> crabs.evening_detective_server.RefreshPasswordRsp + 9, // 9: crabs.evening_detective_server.EveningDetectiveServer.Login:output_type -> crabs.evening_detective_server.LoginRsp + 5, // [5:10] is the sub-list for method output_type + 0, // [0:5] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name 0, // [0:0] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name @@ -443,7 +568,7 @@ func file_main_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_main_proto_rawDesc), len(file_main_proto_rawDesc)), NumEnums: 0, - NumMessages: 8, + NumMessages: 10, NumExtensions: 0, NumServices: 1, }, diff --git a/proto/main.pb.gw.go b/proto/main.pb.gw.go index 066836f..e6991cc 100644 --- a/proto/main.pb.gw.go +++ b/proto/main.pb.gw.go @@ -145,6 +145,33 @@ func local_request_EveningDetectiveServer_RefreshPassword_0(ctx context.Context, return msg, metadata, err } +func request_EveningDetectiveServer_Login_0(ctx context.Context, marshaler runtime.Marshaler, client EveningDetectiveServerClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq LoginReq + metadata runtime.ServerMetadata + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if req.Body != nil { + _, _ = io.Copy(io.Discard, req.Body) + } + msg, err := client.Login(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_EveningDetectiveServer_Login_0(ctx context.Context, marshaler runtime.Marshaler, server EveningDetectiveServerServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq LoginReq + metadata runtime.ServerMetadata + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.Login(ctx, &protoReq) + return msg, metadata, err +} + // RegisterEveningDetectiveServerHandlerServer registers the http handlers for service EveningDetectiveServer to "mux". // UnaryRPC :call EveningDetectiveServerServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -231,6 +258,26 @@ func RegisterEveningDetectiveServerHandlerServer(ctx context.Context, mux *runti } forward_EveningDetectiveServer_RefreshPassword_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) + mux.Handle(http.MethodPost, pattern_EveningDetectiveServer_Login_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/crabs.evening_detective_server.EveningDetectiveServer/Login", runtime.WithHTTPPathPattern("/api/login")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_EveningDetectiveServer_Login_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_EveningDetectiveServer_Login_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) return nil } @@ -339,6 +386,23 @@ func RegisterEveningDetectiveServerHandlerClient(ctx context.Context, mux *runti } forward_EveningDetectiveServer_RefreshPassword_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) + mux.Handle(http.MethodPost, pattern_EveningDetectiveServer_Login_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/crabs.evening_detective_server.EveningDetectiveServer/Login", runtime.WithHTTPPathPattern("/api/login")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_EveningDetectiveServer_Login_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_EveningDetectiveServer_Login_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) return nil } @@ -347,6 +411,7 @@ var ( pattern_EveningDetectiveServer_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"api", "echo"}, "")) pattern_EveningDetectiveServer_Signup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"api", "signup"}, "")) pattern_EveningDetectiveServer_RefreshPassword_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"api", "refresh-password"}, "")) + pattern_EveningDetectiveServer_Login_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"api", "login"}, "")) ) var ( @@ -354,4 +419,5 @@ var ( forward_EveningDetectiveServer_Echo_0 = runtime.ForwardResponseMessage forward_EveningDetectiveServer_Signup_0 = runtime.ForwardResponseMessage forward_EveningDetectiveServer_RefreshPassword_0 = runtime.ForwardResponseMessage + forward_EveningDetectiveServer_Login_0 = runtime.ForwardResponseMessage ) diff --git a/proto/main_grpc.pb.go b/proto/main_grpc.pb.go index 229dbcc..3add31c 100644 --- a/proto/main_grpc.pb.go +++ b/proto/main_grpc.pb.go @@ -23,6 +23,7 @@ const ( EveningDetectiveServer_Echo_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/Echo" EveningDetectiveServer_Signup_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/Signup" EveningDetectiveServer_RefreshPassword_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/RefreshPassword" + EveningDetectiveServer_Login_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/Login" ) // EveningDetectiveServerClient is the client API for EveningDetectiveServer service. @@ -33,6 +34,7 @@ type EveningDetectiveServerClient interface { Echo(ctx context.Context, in *EchoReq, opts ...grpc.CallOption) (*EchoRsp, error) Signup(ctx context.Context, in *SignupReq, opts ...grpc.CallOption) (*SignupRsp, error) RefreshPassword(ctx context.Context, in *RefreshPasswordReq, opts ...grpc.CallOption) (*RefreshPasswordRsp, error) + Login(ctx context.Context, in *LoginReq, opts ...grpc.CallOption) (*LoginRsp, error) } type eveningDetectiveServerClient struct { @@ -83,6 +85,16 @@ func (c *eveningDetectiveServerClient) RefreshPassword(ctx context.Context, in * return out, nil } +func (c *eveningDetectiveServerClient) Login(ctx context.Context, in *LoginReq, opts ...grpc.CallOption) (*LoginRsp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(LoginRsp) + err := c.cc.Invoke(ctx, EveningDetectiveServer_Login_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + // EveningDetectiveServerServer is the server API for EveningDetectiveServer service. // All implementations must embed UnimplementedEveningDetectiveServerServer // for forward compatibility. @@ -91,6 +103,7 @@ type EveningDetectiveServerServer interface { Echo(context.Context, *EchoReq) (*EchoRsp, error) Signup(context.Context, *SignupReq) (*SignupRsp, error) RefreshPassword(context.Context, *RefreshPasswordReq) (*RefreshPasswordRsp, error) + Login(context.Context, *LoginReq) (*LoginRsp, error) mustEmbedUnimplementedEveningDetectiveServerServer() } @@ -113,6 +126,9 @@ func (UnimplementedEveningDetectiveServerServer) Signup(context.Context, *Signup func (UnimplementedEveningDetectiveServerServer) RefreshPassword(context.Context, *RefreshPasswordReq) (*RefreshPasswordRsp, error) { return nil, status.Error(codes.Unimplemented, "method RefreshPassword not implemented") } +func (UnimplementedEveningDetectiveServerServer) Login(context.Context, *LoginReq) (*LoginRsp, error) { + return nil, status.Error(codes.Unimplemented, "method Login not implemented") +} func (UnimplementedEveningDetectiveServerServer) mustEmbedUnimplementedEveningDetectiveServerServer() { } func (UnimplementedEveningDetectiveServerServer) testEmbeddedByValue() {} @@ -207,6 +223,24 @@ func _EveningDetectiveServer_RefreshPassword_Handler(srv interface{}, ctx contex return interceptor(ctx, in, info, handler) } +func _EveningDetectiveServer_Login_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LoginReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(EveningDetectiveServerServer).Login(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: EveningDetectiveServer_Login_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(EveningDetectiveServerServer).Login(ctx, req.(*LoginReq)) + } + return interceptor(ctx, in, info, handler) +} + // EveningDetectiveServer_ServiceDesc is the grpc.ServiceDesc for EveningDetectiveServer service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -230,6 +264,10 @@ var EveningDetectiveServer_ServiceDesc = grpc.ServiceDesc{ MethodName: "RefreshPassword", Handler: _EveningDetectiveServer_RefreshPassword_Handler, }, + { + MethodName: "Login", + Handler: _EveningDetectiveServer_Login_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "main.proto",