From d86514de46f8df51342ecd8628b4353c49c56192 Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Wed, 9 Feb 2022 12:57:13 +0000 Subject: [PATCH] change some comments --- user/handler/handler.go | 2 +- user/proto/user.pb.go | 37 ++++++++++++++++++++++++++++--------- user/proto/user.proto | 21 ++++++++++++--------- 3 files changed, 41 insertions(+), 19 deletions(-) diff --git a/user/handler/handler.go b/user/handler/handler.go index a1935f5..528383d 100644 --- a/user/handler/handler.go +++ b/user/handler/handler.go @@ -257,7 +257,7 @@ func (s *User) VerifyEmail(ctx context.Context, req *pb.VerifyEmailRequest, rsp return errors.BadRequest("user.verifyemail", "missing email") } if len(req.Token) == 0 { - return errors.BadRequest("user.verifyemail", "missing token") + return errors.BadRequest("user.verifytoken", "missing token") } // check the token exists diff --git a/user/proto/user.pb.go b/user/proto/user.pb.go index 577bb46..01a3a6e 100644 --- a/user/proto/user.pb.go +++ b/user/proto/user.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.1 +// protoc v3.15.6 // source: proto/user.proto package user @@ -1073,10 +1073,12 @@ type VerifyEmailRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + // the unique id assigned to the verification process + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // the email address to verify - Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"` + Email string `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"` // The token from the verification email - Token string `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"` + Token string `protobuf:"bytes,3,opt,name=token,proto3" json:"token,omitempty"` } func (x *VerifyEmailRequest) Reset() { @@ -1111,6 +1113,13 @@ func (*VerifyEmailRequest) Descriptor() ([]byte, []int) { return file_proto_user_proto_rawDescGZIP(), []int{18} } +func (x *VerifyEmailRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + func (x *VerifyEmailRequest) GetEmail() string { if x != nil { return x.Email @@ -1163,6 +1172,13 @@ func (*VerifyEmailResponse) Descriptor() ([]byte, []int) { return file_proto_user_proto_rawDescGZIP(), []int{19} } +// Send a verification email to a user. +// Email "from" will be 'noreply@email.m3ocontent.com'. +// The verification link will be injected in the email +// as a template variable, $micro_verification_link e.g +// 'Welcome to M3O! Use the link below to verify your email: $micro_verification_link' +// The variable will be replaced with a url similar to: +// 'https://user.m3o.com/user/verify?token=a-verification-token&redirectUrl=your-redir-url' type SendVerificationEmailRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1174,8 +1190,10 @@ type SendVerificationEmailRequest struct { Subject string `protobuf:"bytes,2,opt,name=subject,proto3" json:"subject,omitempty"` // Text content of the email. Don't forget to include the string '$micro_verification_link' which will be replaced by the real verification link // HTML emails are not available currently. - TextContent string `protobuf:"bytes,3,opt,name=textContent,proto3" json:"textContent,omitempty"` - RedirectUrl string `protobuf:"bytes,4,opt,name=redirectUrl,proto3" json:"redirectUrl,omitempty"` + TextContent string `protobuf:"bytes,3,opt,name=textContent,proto3" json:"textContent,omitempty"` + // The url to redirect to after successful verification + RedirectUrl string `protobuf:"bytes,4,opt,name=redirectUrl,proto3" json:"redirectUrl,omitempty"` + // The url to redirect to incase of failure FailureRedirectUrl string `protobuf:"bytes,5,opt,name=failureRedirectUrl,proto3" json:"failureRedirectUrl,omitempty"` // Display name of the sender for the email. Note: the email address will still be 'noreply@email.m3ocontent.com' FromName string `protobuf:"bytes,6,opt,name=fromName,proto3" json:"fromName,omitempty"` @@ -1983,10 +2001,11 @@ var file_proto_user_proto_rawDesc = []byte{ 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x10, 0x0a, 0x0e, 0x4c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x40, 0x0a, 0x12, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x45, 0x6d, 0x61, 0x69, 0x6c, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x14, 0x0a, - 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, + 0x65, 0x22, 0x50, 0x0a, 0x12, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x45, 0x6d, 0x61, 0x69, 0x6c, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x14, 0x0a, + 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x15, 0x0a, 0x13, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xde, 0x01, 0x0a, 0x1c, 0x53, 0x65, 0x6e, 0x64, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, diff --git a/user/proto/user.proto b/user/proto/user.proto index 2f5582a..c93c84c 100644 --- a/user/proto/user.proto +++ b/user/proto/user.proto @@ -163,24 +163,25 @@ message LogoutResponse { // Verify the email address of an account from a token sent in an email to the user. message VerifyEmailRequest { + // the unique id assigned to the verification process + string id = 1; // the email address to verify - string email = 1; + string email = 2; // The token from the verification email - string token = 2; + string token = 3; } message VerifyEmailResponse{ } -// Send a verification email -// to the user being signed up. Email from will be from 'noreply@email.m3ocontent.com', -// but you can provide the title and contents. -// The verification link will be injected in to the email as a template variable, $micro_verification_link. -// Example: 'Hi there, welcome onboard! Use the link below to verify your email: $micro_verification_link' -// The variable will be replaced with an actual url that will look similar to this: +// Send a verification email to a user. +// Email "from" will be 'noreply@email.m3ocontent.com'. +// The verification link will be injected in the email +// as a template variable, $micro_verification_link e.g +// 'Welcome to M3O! Use the link below to verify your email: $micro_verification_link' +// The variable will be replaced with a url similar to: // 'https://user.m3o.com/user/verify?token=a-verification-token&redirectUrl=your-redir-url' - message SendVerificationEmailRequest{ // email address to send the verification code string email = 1; @@ -189,7 +190,9 @@ message SendVerificationEmailRequest{ // Text content of the email. Don't forget to include the string '$micro_verification_link' which will be replaced by the real verification link // HTML emails are not available currently. string textContent = 3; + // The url to redirect to after successful verification string redirectUrl = 4; + // The url to redirect to incase of failure string failureRedirectUrl = 5; // Display name of the sender for the email. Note: the email address will still be 'noreply@email.m3ocontent.com' string fromName = 6;