Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

feat: init email code signin design and protocol (#20007)

ecmadaoaca458dcb949
diff --git a/backend/api/mcp/gen/openapi.yaml b/backend/api/mcp/gen/openapi.yaml
index e75738207a..b1dca7f91d 100644
--- a/backend/api/mcp/gen/openapi.yaml
+++ b/backend/api/mcp/gen/openapi.yaml
@@ -600,6 +600,122 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/bytebase.v1.RefreshResponse'
+ /bytebase.v1.AuthService/RequestPasswordReset:
+ post:
+ tags:
+ - bytebase.v1.AuthService
+ summary: RequestPasswordReset
+ description: |-
+ Requests a password reset email for the given email address.
+ Always returns success to avoid leaking whether the email exists.
+ Permissions required: None
+ operationId: bytebase.v1.AuthService.RequestPasswordReset
+ parameters:
+ - name: Connect-Protocol-Version
+ in: header
+ required: true
+ schema:
+ $ref: '#/components/schemas/connect-protocol-version'
+ - name: Connect-Timeout-Ms
+ in: header
+ schema:
+ $ref: '#/components/schemas/connect-timeout-header'
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.RequestPasswordResetRequest'
+ required: true
+ responses:
+ default:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/connect.error'
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/google.protobuf.Empty'
+ /bytebase.v1.AuthService/ResetPassword:
+ post:
+ tags:
+ - bytebase.v1.AuthService
+ summary: ResetPassword
+ description: |-
+ Resets the user's password using a password reset token from email.
+ Permissions required: None (validates via token)
+ operationId: bytebase.v1.AuthService.ResetPassword
+ parameters:
+ - name: Connect-Protocol-Version
+ in: header
+ required: true
+ schema:
+ $ref: '#/components/schemas/connect-protocol-version'
+ - name: Connect-Timeout-Ms
+ in: header
+ schema:
+ $ref: '#/components/schemas/connect-timeout-header'
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.ResetPasswordRequest'
+ required: true
+ responses:
+ default:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/connect.error'
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/google.protobuf.Empty'
+ /bytebase.v1.AuthService/SendEmailLoginCode:
+ post:
+ tags:
+ - bytebase.v1.AuthService
+ summary: SendEmailLoginCode
+ description: |-
+ Sends a 6-digit verification code to the email for login/signup.
+ Always returns success (no email enumeration). Enforces 60-sec resend cooldown.
+ Permissions required: None
+ operationId: bytebase.v1.AuthService.SendEmailLoginCode
+ parameters:
+ - name: Connect-Protocol-Version
+ in: header
+ required: true
+ schema:
+ $ref: '#/components/schemas/connect-protocol-version'
+ - name: Connect-Timeout-Ms
+ in: header
+ schema:
+ $ref: '#/components/schemas/connect-timeout-header'
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.SendEmailLoginCodeRequest'
+ required: true
+ responses:
+ default:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/connect.error'
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/google.protobuf.Empty'
/bytebase.v1.AuthService/Signup:
post:
tags:
@@ -13911,6 +14027,14 @@ components:
- "null"
title: mfa_temp_token
description: The mfa_temp_token is used to verify the user's identity by MFA.
+ emailCode:
+ type:
+ - string
+ - "null"
+ title: email_code
+ description: |-
+ 6-digit code from email for passwordless login/signup.
+ Pairs with `email`. Mutually exclusive with `password` and `idp_name`.
title: LoginRequest
additionalProperties: false
bytebase.v1.LoginResponse:
@@ -15891,6 +16015,42 @@ components:
title: RequestMetadata
additionalProperties: false
description: Metadata about the incoming request.
+ bytebase.v1.RequestPasswordResetRequest:
+ type: object
+ properties:
+ email:
+ type: string
+ title: email
+ description: The email address of the account to reset.
+ workspace:
+ type:
+ - string
+ - "null"
+ title: workspace
+ description: |-
+ Optional workspace context captured at send time, used to locate the EMAIL setting,
+ and later (at verify time) for signup gate checks and workspace assignment.
+ Unset for SaaS brand-new signup (no workspace exists yet).
+ Format: workspaces/{workspace}
+ title: RequestPasswordResetRequest
+ additionalProperties: false
+ bytebase.v1.ResetPasswordRequest:
+ type: object
+ properties:
+ email:
+ type: string
+ title: email
+ description: The email address of the account.
+ code:
+ type: string
+ title: code
+ description: The 6-digit code from the reset email.
+ newPassword:
+ type: string
+ title: new_password
+ description: The new password to set.
+ title: ResetPasswordRequest
+ additionalProperties: false
bytebase.v1.Restriction:
type: object
properties:
@@ -15906,6 +16066,10 @@ components:
title: password_restriction
description: Password complexity and restriction requirements.
$ref: '#/components/schemas/bytebase.v1.WorkspaceProfileSetting.PasswordRestriction'
+ allowEmailCodeSignin:
+ type: boolean
+ title: allow_email_code_signin
+ description: Whether email + 6-digit code signin is enabled for this workspace.
title: Restriction
additionalProperties: false
bytebase.v1.ReviewConfig:
@@ -17112,6 +17276,25 @@ components:
description: icon is the icon for semantic type, it can be emoji or base64 encoded image.
title: SemanticType
additionalProperties: false
+ bytebase.v1.SendEmailLoginCodeRequest:
+ type: object
+ properties:
+ email:
+ type: string
+ title: email
+ description: The email address to send the code to.
+ workspace:
+ type:
+ - string
+ - "null"
+ title: workspace
+ description: |-
+ Optional workspace context captured at send time, used to locate the EMAIL setting,
+ and later (at verify time) for signup gate checks and workspace assignment.
+ Unset for SaaS brand-new signup (no workspace exists yet).
+ Format: workspaces/{workspace}
+ title: SendEmailLoginCodeRequest
+ additionalProperties: false
bytebase.v1.SequenceMetadata:
type: object
properties:
@@ -20108,6 +20291,12 @@ components:
title: query_timeout
description: The query timeout duration for query and export, works for the SQL Editor and Export Center.
$ref: '#/components/schemas/google.protobuf.Duration'
+ allowEmailCodeSignin:
+ type: boolean
+ title: allow_email_code_signin
+ description: |-
+ Allow signin/signup using email + a 6-digit one-time verification code.
+ Requires the EMAIL setting to be configured on the workspace.
title: WorkspaceProfileSetting
additionalProperties: false
bytebase.v1.WorkspaceProfileSetting.PasswordRestriction:
diff --git a/backend/generated-go/store/auth.pb.go b/backend/generated-go/store/auth.pb.go
new file mode 100644
index 0000000000..c74a5ad116
--- /dev/null
+++ b/backend/generated-go/store/auth.pb.go
@@ -0,0 +1,132 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.36.11
+// protoc (unknown)
+// source: store/auth.proto
+
+package store
+
+import (
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ reflect "reflect"
+ sync "sync"
+ unsafe "unsafe"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+// EmailVerificationCodePurpose distinguishes login codes from password reset codes.
+// Stored as the enum name string in email_verification_code.purpose column.
+type EmailVerificationCodePurpose int32
+
+const (
+ EmailVerificationCodePurpose_EMAIL_VERIFICATION_CODE_PURPOSE_UNSPECIFIED EmailVerificationCodePurpose = 0
+ EmailVerificationCodePurpose_LOGIN EmailVerificationCodePurpose = 1
+ EmailVerificationCodePurpose_PASSWORD_RESET EmailVerificationCodePurpose = 2
+)
+
+// Enum value maps for EmailVerificationCodePurpose.
+var (
+ EmailVerificationCodePurpose_name = map[int32]string{
+ 0: "EMAIL_VERIFICATION_CODE_PURPOSE_UNSPECIFIED",
+ 1: "LOGIN",
+ 2: "PASSWORD_RESET",
+ }
+ EmailVerificationCodePurpose_value = map[string]int32{
+ "EMAIL_VERIFICATION_CODE_PURPOSE_UNSPECIFIED": 0,
+ "LOGIN": 1,
+ "PASSWORD_RESET": 2,
+ }
+)
+
+func (x EmailVerificationCodePurpose) Enum() *EmailVerificationCodePurpose {
+ p := new(EmailVerificationCodePurpose)
+ *p = x
+ return p
+}
+
+func (x EmailVerificationCodePurpose) String() string {
+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (EmailVerificationCodePurpose) Descriptor() protoreflect.EnumDescriptor {
+ return file_store_auth_proto_enumTypes[0].Descriptor()
+}
+
+func (EmailVerificationCodePurpose) Type() protoreflect.EnumType {
+ return &file_store_auth_proto_enumTypes[0]
+}
+
+func (x EmailVerificationCodePurpose) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Use EmailVerificationCodePurpose.Descriptor instead.
+func (EmailVerificationCodePurpose) EnumDescriptor() ([]byte, []int) {
+ return file_store_auth_proto_rawDescGZIP(), []int{0}
+}
+
+var File_store_auth_proto protoreflect.FileDescriptor
+
+const file_store_auth_proto_rawDesc = "" +
+ "\n" +
+ "\x10store/auth.proto\x12\x0ebytebase.store*n\n" +
+ "\x1cEmailVerificationCodePurpose\x12/\n" +
+ "+EMAIL_VERIFICATION_CODE_PURPOSE_UNSPECIFIED\x10\x00\x12\t\n" +
+ "\x05LOGIN\x10\x01\x12\x12\n" +
+ "\x0ePASSWORD_RESET\x10\x02B\x8c\x01\n" +
+ "\x12com.bytebase.storeB\tAuthProtoP\x01Z\x12generated-go/store\xa2\x02\x03BSX\xaa\x02\x0eBytebase.Store\xca\x02\x0eBytebase\\Store\xe2\x02\x1aBytebase\\Store\\GPBMetadata\xea\x02\x0fBytebase::Storeb\x06proto3"
+
+var (
+ file_store_auth_proto_rawDescOnce sync.Once
+ file_store_auth_proto_rawDescData []byte
+)
+
+func file_store_auth_proto_rawDescGZIP() []byte {
+ file_store_auth_proto_rawDescOnce.Do(func() {
+ file_store_auth_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_store_auth_proto_rawDesc), len(file_store_auth_proto_rawDesc)))
+ })
+ return file_store_auth_proto_rawDescData
+}
+
+var file_store_auth_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
+var file_store_auth_proto_goTypes = []any{
+ (EmailVerificationCodePurpose)(0), // 0: bytebase.store.EmailVerificationCodePurpose
+}
+var file_store_auth_proto_depIdxs = []int32{
+ 0, // [0:0] is the sub-list for method output_type
+ 0, // [0:0] 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
+}
+
+func init() { file_store_auth_proto_init() }
+func file_store_auth_proto_init() {
+ if File_store_auth_proto != nil {
+ return
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: unsafe.Slice(unsafe.StringData(file_store_auth_proto_rawDesc), len(file_store_auth_proto_rawDesc)),
+ NumEnums: 1,
+ NumMessages: 0,
+ NumExtensions: 0,
+ NumServices: 0,
+ },
+ GoTypes: file_store_auth_proto_goTypes,
+ DependencyIndexes: file_store_auth_proto_depIdxs,
+ EnumInfos: file_store_auth_proto_enumTypes,
+ }.Build()
+ File_store_auth_proto = out.File
+ file_store_auth_proto_goTypes = nil
+ file_store_auth_proto_depIdxs = nil
+}
diff --git a/backend/generated-go/store/auth_equal.pb.go b/backend/generated-go/store/auth_equal.pb.go
new file mode 100644
index 0000000000..c97b40a0e9
--- /dev/null
+++ b/backend/generated-go/store/auth_equal.pb.go
@@ -0,0 +1,4 @@
+// Code generated by protoc-gen-equal-go. DO NOT EDIT.
+// source: store/auth.proto
+
+package store
diff --git a/backend/generated-go/store/setting.pb.go b/backend/generated-go/store/setting.pb.go
index d72db4626c..644b0813c6 100644
--- a/backend/generated-go/store/setting.pb.go
+++ b/backend/generated-go/store/setting.pb.go
@@ -603,9 +603,12 @@ type WorkspaceProfileSetting struct {
// The default value is 100MB, we will use the default value if the setting not exists, or the limit <= 0.
SqlResultSize int64 `protobuf:"varint,20,opt,name=sql_result_size,json=sqlResultSize,proto3" json:"sql_result_size,omitempty"`
// The query timeout duration for query and export, works for the SQL Editor and Export Center.
- QueryTimeout *durationpb.Duration `protobuf:"bytes,21,opt,name=query_timeout,json=queryTimeout,proto3" json:"query_timeout,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
+ QueryTimeout *durationpb.Duration `protobuf:"bytes,21,opt,name=query_timeout,json=queryTimeout,proto3" json:"query_timeout,omitempty"`
+ // Allow signin/signup using email + a 6-digit one-time verification code.
+ // Requires the EMAIL setting to be configured on the workspace.
+ AllowEmailCodeSignin bool `protobuf:"varint,22,opt,name=allow_email_code_signin,json=allowEmailCodeSignin,proto3" json:"allow_email_code_signin,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
}
func (x *WorkspaceProfileSetting) Reset() {
@@ -778,6 +781,13 @@ func (x *WorkspaceProfileSetting) GetQueryTimeout() *durationpb.Duration {
return nil
}
+func (x *WorkspaceProfileSetting) GetAllowEmailCodeSignin() bool {
+ if x != nil {
+ return x.AllowEmailCodeSignin
+ }
+ return false
+}
+
type WorkspaceApprovalSetting struct {
state protoimpl.MessageState `protogen:"open.v1"`
Rules []*WorkspaceApprovalSetting_Rule `protobuf:"bytes,1,rep,name=rules,proto3" json:"rules,omitempty"`
@@ -2702,7 +2712,7 @@ const file_store_setting_proto_rawDesc = "" +
"\n" +
"\x13store/setting.proto\x12\x0ebytebase.store\x1a\x1fgoogle/api/field_behavior.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x16google/type/expr.proto\x1a\x14store/approval.proto\x1a\x12store/common.proto\"P\n" +
"\rSystemSetting\x12\x18\n" +
- "\alicense\x18\x03 \x01(\tR\alicenseJ\x04\b\x01\x10\x02J\x04\b\x02\x10\x03R\vauth_secretR\fworkspace_id\"\xb0\x0f\n" +
+ "\alicense\x18\x03 \x01(\tR\alicenseJ\x04\b\x01\x10\x02J\x04\b\x02\x10\x03R\vauth_secretR\fworkspace_id\"\xe7\x0f\n" +
"\x17WorkspaceProfileSetting\x12!\n" +
"\fexternal_url\x18\x01 \x01(\tR\vexternalUrl\x12'\n" +
"\x0fdisallow_signup\x18\x02 \x01(\bR\x0edisallowSignup\x12\x1f\n" +
@@ -2725,7 +2735,8 @@ const file_store_setting_proto_rawDesc = "" +
"\x15access_token_duration\x18\x12 \x01(\v2\x19.google.protobuf.DurationR\x13accessTokenDuration\x12!\n" +
"\fenable_debug\x18\x13 \x01(\bR\venableDebug\x12&\n" +
"\x0fsql_result_size\x18\x14 \x01(\x03R\rsqlResultSize\x12>\n" +
- "\rquery_timeout\x18\x15 \x01(\v2\x19.google.protobuf.DurationR\fqueryTimeout\x1a\xdd\x01\n" +
+ "\rquery_timeout\x18\x15 \x01(\v2\x19.google.protobuf.DurationR\fqueryTimeout\x125\n" +
+ "\x17allow_email_code_signin\x18\x16 \x01(\bR\x14allowEmailCodeSignin\x1a\xdd\x01\n" +
"\fAnnouncement\x12U\n" +
"\x05level\x18\x01 \x01(\x0e2?.bytebase.store.WorkspaceProfileSetting.Announcement.AlertLevelR\x05level\x12\x12\n" +
"\x04text\x18\x02 \x01(\tR\x04text\x12\x12\n" +
diff --git a/backend/generated-go/store/setting_equal.pb.go b/backend/generated-go/store/setting_equal.pb.go
index 774be888cc..d79d456bce 100644
--- a/backend/generated-go/store/setting_equal.pb.go
+++ b/backend/generated-go/store/setting_equal.pb.go
@@ -143,6 +143,9 @@ func (x *WorkspaceProfileSetting) Equal(y *WorkspaceProfileSetting) bool {
if p, q := x.QueryTimeout, y.QueryTimeout; (p == nil && q != nil) || (p != nil && (q == nil || p.Seconds != q.Seconds || p.Nanos != q.Nanos)) {
return false
}
+ if x.AllowEmailCodeSignin != y.AllowEmailCodeSignin {
+ return false
+ }
return true
}
diff --git a/backend/generated-go/v1/actuator_service.pb.go b/backend/generated-go/v1/actuator_service.pb.go
index 39380cf779..88d5e6d0a1 100644
--- a/backend/generated-go/v1/actuator_service.pb.go
+++ b/backend/generated-go/v1/actuator_service.pb.go
@@ -155,8 +155,10 @@ type Restriction struct {
DisallowPasswordSignin bool `protobuf:"varint,2,opt,name=disallow_password_signin,json=disallowPasswordSignin,proto3" json:"disallow_password_signin,omitempty"`
// Password complexity and restriction requirements.
PasswordRestriction *WorkspaceProfileSetting_PasswordRestriction `protobuf:"bytes,3,opt,name=password_restriction,json=passwordRestriction,proto3" json:"password_restriction,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
+ // Whether email + 6-digit code signin is enabled for this workspace.
+ AllowEmailCodeSignin bool `protobuf:"varint,4,opt,name=allow_email_code_signin,json=allowEmailCodeSignin,proto3" json:"allow_email_code_signin,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
}
func (x *Restriction) Reset() {
@@ -210,6 +212,13 @@ func (x *Restriction) GetPasswordRestriction() *WorkspaceProfileSetting_Password
return nil
}
+func (x *Restriction) GetAllowEmailCodeSignin() bool {
+ if x != nil {
+ return x.AllowEmailCodeSignin
+ }
+ return false
+}
+
// System information and configuration for the Bytebase instance.
// Actuator concept is similar to the Spring Boot Actuator.
type ActuatorInfo struct {
@@ -447,11 +456,12 @@ const file_v1_actuator_service_proto_rawDesc = "" +
"\x16GetActuatorInfoRequest\x12/\n" +
"\x04name\x18\x01 \x01(\tB\x1b\xfaA\x18\n" +
"\x16bytebase.com/WorkspaceR\x04name\"\x14\n" +
- "\x12DeleteCacheRequest\"\xec\x01\n" +
+ "\x12DeleteCacheRequest\"\xa8\x02\n" +
"\vRestriction\x12,\n" +
"\x0fdisallow_signup\x18\x01 \x01(\bB\x03\xe0A\x03R\x0edisallowSignup\x12=\n" +
"\x18disallow_password_signin\x18\x02 \x01(\bB\x03\xe0A\x03R\x16disallowPasswordSignin\x12p\n" +
- "\x14password_restriction\x18\x03 \x01(\v28.bytebase.v1.WorkspaceProfileSetting.PasswordRestrictionB\x03\xe0A\x03R\x13passwordRestriction\"\xbd\a\n" +
+ "\x14password_restriction\x18\x03 \x01(\v28.bytebase.v1.WorkspaceProfileSetting.PasswordRestrictionB\x03\xe0A\x03R\x13passwordRestriction\x12:\n" +
+ "\x17allow_email_code_signin\x18\x04 \x01(\bB\x03\xe0A\x03R\x14allowEmailCodeSignin\"\xbd\a\n" +
"\fActuatorInfo\x12\x1d\n" +
"\aversion\x18\x01 \x01(\tB\x03\xe0A\x03R\aversion\x12\"\n" +
"\n" +
diff --git a/backend/generated-go/v1/actuator_service_equal.pb.go b/backend/generated-go/v1/actuator_service_equal.pb.go
index c1955957a1..c65a466159 100644
--- a/backend/generated-go/v1/actuator_service_equal.pb.go
+++ b/backend/generated-go/v1/actuator_service_equal.pb.go
@@ -52,6 +52,9 @@ func (x *Restriction) Equal(y *Restriction) bool {
if !x.PasswordRestriction.Equal(y.PasswordRestriction) {
return false
}
+ if x.AllowEmailCodeSignin != y.AllowEmailCodeSignin {
+ return false
+ }
return true
}
diff --git a/backend/generated-go/v1/auth_service.pb.go b/backend/generated-go/v1/auth_service.pb.go
index a386ae588d..6805bc1ec5 100644
--- a/backend/generated-go/v1/auth_service.pb.go
+++ b/backend/generated-go/v1/auth_service.pb.go
@@ -42,7 +42,10 @@ type LoginRequest struct {
// The recovery_code is used to recovery the user's identity with MFA.
RecoveryCode *string `protobuf:"bytes,7,opt,name=recovery_code,json=recoveryCode,proto3,oneof" json:"recovery_code,omitempty"`
// The mfa_temp_token is used to verify the user's identity by MFA.
- MfaTempToken *string `protobuf:"bytes,8,opt,name=mfa_temp_token,json=mfaTempToken,proto3,oneof" json:"mfa_temp_token,omitempty"`
+ MfaTempToken *string `protobuf:"bytes,8,opt,name=mfa_temp_token,json=mfaTempToken,proto3,oneof" json:"mfa_temp_token,omitempty"`
+ // 6-digit code from email for passwordless login/signup.
+ // Pairs with `email`. Mutually exclusive with `password` and `idp_name`.
+ EmailCode *string `protobuf:"bytes,9,opt,name=email_code,json=emailCode,proto3,oneof" json:"email_code,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@@ -133,6 +136,13 @@ func (x *LoginRequest) GetMfaTempToken() string {
return ""
}
+func (x *LoginRequest) GetEmailCode() string {
+ if x != nil && x.EmailCode != nil {
+ return *x.EmailCode
+ }
+ return ""
+}
+
// Context for identity provider authentication.
type IdentityProviderContext struct {
state protoimpl.MessageState `protogen:"open.v1"`
@@ -657,6 +667,183 @@ func (*RefreshResponse) Descriptor() ([]byte, []int) {
return file_v1_auth_service_proto_rawDescGZIP(), []int{10}
}
+type RequestPasswordResetRequest struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // The email address of the account to reset.
+ Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"`
+ // Optional workspace context captured at send time, used to locate the EMAIL setting,
+ // and later (at verify time) for signup gate checks and workspace assignment.
+ // Unset for SaaS brand-new signup (no workspace exists yet).
+ // Format: workspaces/{workspace}
+ Workspace *string `protobuf:"bytes,2,opt,name=workspace,proto3,oneof" json:"workspace,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *RequestPasswordResetRequest) Reset() {
+ *x = RequestPasswordResetRequest{}
+ mi := &file_v1_auth_service_proto_msgTypes[11]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *RequestPasswordResetRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*RequestPasswordResetRequest) ProtoMessage() {}
+
+func (x *RequestPasswordResetRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_v1_auth_service_proto_msgTypes[11]
+ 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 RequestPasswordResetRequest.ProtoReflect.Descriptor instead.
+func (*RequestPasswordResetRequest) Descriptor() ([]byte, []int) {
+ return file_v1_auth_service_proto_rawDescGZIP(), []int{11}
+}
+
+func (x *RequestPasswordResetRequest) GetEmail() string {
+ if x != nil {
+ return x.Email
+ }
+ return ""
+}
+
+func (x *RequestPasswordResetRequest) GetWorkspace() string {
+ if x != nil && x.Workspace != nil {
+ return *x.Workspace
+ }
+ return ""
+}
+
+type ResetPasswordRequest struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // The email address of the account.
+ Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"`
+ // The 6-digit code from the reset email.
+ Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"`
+ // The new password to set.
+ NewPassword string `protobuf:"bytes,3,opt,name=new_password,json=newPassword,proto3" json:"new_password,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *ResetPasswordRequest) Reset() {
+ *x = ResetPasswordRequest{}
+ mi := &file_v1_auth_service_proto_msgTypes[12]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *ResetPasswordRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ResetPasswordRequest) ProtoMessage() {}
+
+func (x *ResetPasswordRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_v1_auth_service_proto_msgTypes[12]
+ 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 ResetPasswordRequest.ProtoReflect.Descriptor instead.
+func (*ResetPasswordRequest) Descriptor() ([]byte, []int) {
+ return file_v1_auth_service_proto_rawDescGZIP(), []int{12}
+}
+
+func (x *ResetPasswordRequest) GetEmail() string {
+ if x != nil {
+ return x.Email
+ }
+ return ""
+}
+
+func (x *ResetPasswordRequest) GetCode() string {
+ if x != nil {
+ return x.Code
+ }
+ return ""
+}
+
+func (x *ResetPasswordRequest) GetNewPassword() string {
+ if x != nil {
+ return x.NewPassword
+ }
+ return ""
+}
+
+type SendEmailLoginCodeRequest struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // The email address to send the code to.
+ Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"`
+ // Optional workspace context captured at send time, used to locate the EMAIL setting,
+ // and later (at verify time) for signup gate checks and workspace assignment.
+ // Unset for SaaS brand-new signup (no workspace exists yet).
+ // Format: workspaces/{workspace}
+ Workspace *string `protobuf:"bytes,2,opt,name=workspace,proto3,oneof" json:"workspace,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *SendEmailLoginCodeRequest) Reset() {
+ *x = SendEmailLoginCodeRequest{}
+ mi := &file_v1_auth_service_proto_msgTypes[13]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *SendEmailLoginCodeRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*SendEmailLoginCodeRequest) ProtoMessage() {}
+
+func (x *SendEmailLoginCodeRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_v1_auth_service_proto_msgTypes[13]
+ 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 SendEmailLoginCodeRequest.ProtoReflect.Descriptor instead.
+func (*SendEmailLoginCodeRequest) Descriptor() ([]byte, []int) {
+ return file_v1_auth_service_proto_rawDescGZIP(), []int{13}
+}
+
+func (x *SendEmailLoginCodeRequest) GetEmail() string {
+ if x != nil {
+ return x.Email
+ }
+ return ""
+}
+
+func (x *SendEmailLoginCodeRequest) GetWorkspace() string {
+ if x != nil && x.Workspace != nil {
+ return *x.Workspace
+ }
+ return ""
+}
+
type SwitchWorkspaceRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
// The target workspace to switch to.
@@ -676,7 +863,7 @@ type SwitchWorkspaceRequest struct {
func (x *SwitchWorkspaceRequest) Reset() {
*x = SwitchWorkspaceRequest{}
- mi := &file_v1_auth_service_proto_msgTypes[11]
+ mi := &file_v1_auth_service_proto_msgTypes[14]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -688,7 +875,7 @@ func (x *SwitchWorkspaceRequest) String() string {
func (*SwitchWorkspaceRequest) ProtoMessage() {}
func (x *SwitchWorkspaceRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_auth_service_proto_msgTypes[11]
+ mi := &file_v1_auth_service_proto_msgTypes[14]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -701,7 +888,7 @@ func (x *SwitchWorkspaceRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use SwitchWorkspaceRequest.ProtoReflect.Descriptor instead.
func (*SwitchWorkspaceRequest) Descriptor() ([]byte, []int) {
- return file_v1_auth_service_proto_rawDescGZIP(), []int{11}
+ return file_v1_auth_service_proto_rawDescGZIP(), []int{14}
}
func (x *SwitchWorkspaceRequest) GetWorkspace() string {
@@ -743,7 +930,7 @@ var File_v1_auth_service_proto protoreflect.FileDescriptor
const file_v1_auth_service_proto_rawDesc = "" +
"\n" +
- "\x15v1/auth_service.proto\x12\vbytebase.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a\x13v1/annotation.proto\x1a\x15v1/user_service.proto\"\xdb\x02\n" +
+ "\x15v1/auth_service.proto\x12\vbytebase.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a\x13v1/annotation.proto\x1a\x15v1/user_service.proto\"\x8e\x03\n" +
"\fLoginRequest\x12\x14\n" +
"\x05email\x18\x01 \x01(\tR\x05email\x12\x1a\n" +
"\bpassword\x18\x02 \x01(\tR\bpassword\x12\x10\n" +
@@ -753,10 +940,13 @@ const file_v1_auth_service_proto_rawDesc = "" +
"idpContext\x12\x1e\n" +
"\botp_code\x18\x06 \x01(\tH\x00R\aotpCode\x88\x01\x01\x12(\n" +
"\rrecovery_code\x18\a \x01(\tH\x01R\frecoveryCode\x88\x01\x01\x12)\n" +
- "\x0emfa_temp_token\x18\b \x01(\tH\x02R\fmfaTempToken\x88\x01\x01B\v\n" +
+ "\x0emfa_temp_token\x18\b \x01(\tH\x02R\fmfaTempToken\x88\x01\x01\x12\"\n" +
+ "\n" +
+ "email_code\x18\t \x01(\tH\x03R\temailCode\x88\x01\x01B\v\n" +
"\t_otp_codeB\x10\n" +
"\x0e_recovery_codeB\x11\n" +
- "\x0f_mfa_temp_token\"\xc8\x01\n" +
+ "\x0f_mfa_temp_tokenB\r\n" +
+ "\v_email_code\"\xc8\x01\n" +
"\x17IdentityProviderContext\x12S\n" +
"\x0eoauth2_context\x18\x01 \x01(\v2*.bytebase.v1.OAuth2IdentityProviderContextH\x00R\roauth2Context\x12M\n" +
"\foidc_context\x18\x02 \x01(\v2(.bytebase.v1.OIDCIdentityProviderContextH\x00R\voidcContextB\t\n" +
@@ -782,7 +972,21 @@ const file_v1_auth_service_proto_rawDesc = "" +
"\bpassword\x18\x02 \x01(\tR\bpassword\x12\x14\n" +
"\x05title\x18\x03 \x01(\tR\x05title\"\x10\n" +
"\x0eRefreshRequest\"\x11\n" +
- "\x0fRefreshResponse\"\xef\x01\n" +
+ "\x0fRefreshResponse\"d\n" +
+ "\x1bRequestPasswordResetRequest\x12\x14\n" +
+ "\x05email\x18\x01 \x01(\tR\x05email\x12!\n" +
+ "\tworkspace\x18\x02 \x01(\tH\x00R\tworkspace\x88\x01\x01B\f\n" +
+ "\n" +
+ "_workspace\"c\n" +
+ "\x14ResetPasswordRequest\x12\x14\n" +
+ "\x05email\x18\x01 \x01(\tR\x05email\x12\x12\n" +
+ "\x04code\x18\x02 \x01(\tR\x04code\x12!\n" +
+ "\fnew_password\x18\x03 \x01(\tR\vnewPassword\"b\n" +
+ "\x19SendEmailLoginCodeRequest\x12\x14\n" +
+ "\x05email\x18\x01 \x01(\tR\x05email\x12!\n" +
+ "\tworkspace\x18\x02 \x01(\tH\x00R\tworkspace\x88\x01\x01B\f\n" +
+ "\n" +
+ "_workspace\"\xef\x01\n" +
"\x16SwitchWorkspaceRequest\x12\x1c\n" +
"\tworkspace\x18\x01 \x01(\tR\tworkspace\x12\x10\n" +
"\x03web\x18\x02 \x01(\bR\x03web\x12\x1e\n" +
@@ -791,14 +995,17 @@ const file_v1_auth_service_proto_rawDesc = "" +
"\x0emfa_temp_token\x18\x05 \x01(\tH\x02R\fmfaTempToken\x88\x01\x01B\v\n" +
"\t_otp_codeB\x10\n" +
"\x0e_recovery_codeB\x11\n" +
- "\x0f_mfa_temp_token2\xa0\x05\n" +
+ "\x0f_mfa_temp_token2\xa3\b\n" +
"\vAuthService\x12a\n" +
"\x05Login\x12\x19.bytebase.v1.LoginRequest\x1a\x1a.bytebase.v1.LoginResponse\"!\x80\xea0\x01\x98\xea0\x01\x82\xd3\xe4\x93\x02\x13:\x01*\"\x0e/v1/auth/login\x12`\n" +
"\x06Logout\x12\x1a.bytebase.v1.LogoutRequest\x1a\x16.google.protobuf.Empty\"\"\x80\xea0\x01\x98\xea0\x01\x82\xd3\xe4\x93\x02\x14:\x01*\"\x0f/v1/auth/logout\x12\x81\x01\n" +
"\rExchangeToken\x12!.bytebase.v1.ExchangeTokenRequest\x1a\".bytebase.v1.ExchangeTokenResponse\")\x80\xea0\x01\x98\xea0\x01\x82\xd3\xe4\x93\x02\x1b:\x01*\"\x16/v1/auth:exchangeToken\x12d\n" +
"\x06Signup\x12\x1a.bytebase.v1.SignupRequest\x1a\x1a.bytebase.v1.LoginResponse\"\"\x80\xea0\x01\x98\xea0\x01\x82\xd3\xe4\x93\x02\x14:\x01*\"\x0f/v1/auth/signup\x12e\n" +
"\aRefresh\x12\x1b.bytebase.v1.RefreshRequest\x1a\x1c.bytebase.v1.RefreshResponse\"\x1f\x80\xea0\x01\x82\xd3\xe4\x93\x02\x15:\x01*\"\x10/v1/auth/refresh\x12{\n" +
- "\x0fSwitchWorkspace\x12#.bytebase.v1.SwitchWorkspaceRequest\x1a\x1a.bytebase.v1.LoginResponse\"'\x90\xea0\x02\x82\xd3\xe4\x93\x02\x1d:\x01*\"\x18/v1/auth:switchWorkspaceB\xa6\x01\n" +
+ "\x0fSwitchWorkspace\x12#.bytebase.v1.SwitchWorkspaceRequest\x1a\x1a.bytebase.v1.LoginResponse\"'\x90\xea0\x02\x82\xd3\xe4\x93\x02\x1d:\x01*\"\x18/v1/auth:switchWorkspace\x12\x86\x01\n" +
+ "\x14RequestPasswordReset\x12(.bytebase.v1.RequestPasswordResetRequest\x1a\x16.google.protobuf.Empty\",\x80\xea0\x01\x82\xd3\xe4\x93\x02\":\x01*\"\x1d/v1/auth:requestPasswordReset\x12q\n" +
+ "\rResetPassword\x12!.bytebase.v1.ResetPasswordRequest\x1a\x16.google.protobuf.Empty\"%\x80\xea0\x01\x82\xd3\xe4\x93\x02\x1b:\x01*\"\x16/v1/auth:resetPassword\x12\x84\x01\n" +
+ "\x12SendEmailLoginCode\x12&.bytebase.v1.SendEmailLoginCodeRequest\x1a\x16.google.protobuf.Empty\".\x80\xea0\x01\x98\xea0\x01\x82\xd3\xe4\x93\x02 :\x01*\"\x1b/v1/auth:sendEmailLoginCodeB\xa6\x01\n" +
"\x0fcom.bytebase.v1B\x10AuthServiceProtoP\x01Z4github.com/bytebase/bytebase/backend/generated-go/v1\xa2\x02\x03BXX\xaa\x02\vBytebase.V1\xca\x02\vBytebase\\V1\xe2\x02\x17Bytebase\\V1\\GPBMetadata\xea\x02\fBytebase::V1b\x06proto3"
var (
@@ -813,7 +1020,7 @@ func file_v1_auth_service_proto_rawDescGZIP() []byte {
return file_v1_auth_service_proto_rawDescData
}
-var file_v1_auth_service_proto_msgTypes = make([]protoimpl.MessageInfo, 12)
+var file_v1_auth_service_proto_msgTypes = make([]protoimpl.MessageInfo, 15)
var file_v1_auth_service_proto_goTypes = []any{
(*LoginRequest)(nil), // 0: bytebase.v1.LoginRequest
(*IdentityProviderContext)(nil), // 1: bytebase.v1.IdentityProviderContext
@@ -826,29 +1033,38 @@ var file_v1_auth_service_proto_goTypes = []any{
(*SignupRequest)(nil), // 8: bytebase.v1.SignupRequest
(*RefreshRequest)(nil), // 9: bytebase.v1.RefreshRequest
(*RefreshResponse)(nil), // 10: bytebase.v1.RefreshResponse
- (*SwitchWorkspaceRequest)(nil), // 11: bytebase.v1.SwitchWorkspaceRequest
- (*User)(nil), // 12: bytebase.v1.User
- (*emptypb.Empty)(nil), // 13: google.protobuf.Empty
+ (*RequestPasswordResetRequest)(nil), // 11: bytebase.v1.RequestPasswordResetRequest
+ (*ResetPasswordRequest)(nil), // 12: bytebase.v1.ResetPasswordRequest
+ (*SendEmailLoginCodeRequest)(nil), // 13: bytebase.v1.SendEmailLoginCodeRequest
+ (*SwitchWorkspaceRequest)(nil), // 14: bytebase.v1.SwitchWorkspaceRequest
+ (*User)(nil), // 15: bytebase.v1.User
+ (*emptypb.Empty)(nil), // 16: google.protobuf.Empty
}
var file_v1_auth_service_proto_depIdxs = []int32{
1, // 0: bytebase.v1.LoginRequest.idp_context:type_name -> bytebase.v1.IdentityProviderContext
2, // 1: bytebase.v1.IdentityProviderContext.oauth2_context:type_name -> bytebase.v1.OAuth2IdentityProviderContext
3, // 2: bytebase.v1.IdentityProviderContext.oidc_context:type_name -> bytebase.v1.OIDCIdentityProviderContext
- 12, // 3: bytebase.v1.LoginResponse.user:type_name -> bytebase.v1.User
+ 15, // 3: bytebase.v1.LoginResponse.user:type_name -> bytebase.v1.User
0, // 4: bytebase.v1.AuthService.Login:input_type -> bytebase.v1.LoginRequest
5, // 5: bytebase.v1.AuthService.Logout:input_type -> bytebase.v1.LogoutRequest
6, // 6: bytebase.v1.AuthService.ExchangeToken:input_type -> bytebase.v1.ExchangeTokenRequest
8, // 7: bytebase.v1.AuthService.Signup:input_type -> bytebase.v1.SignupRequest
9, // 8: bytebase.v1.AuthService.Refresh:input_type -> bytebase.v1.RefreshRequest
- 11, // 9: bytebase.v1.AuthService.SwitchWorkspace:input_type -> bytebase.v1.SwitchWorkspaceRequest
- 4, // 10: bytebase.v1.AuthService.Login:output_type -> bytebase.v1.LoginResponse
- 13, // 11: bytebase.v1.AuthService.Logout:output_type -> google.protobuf.Empty
- 7, // 12: bytebase.v1.AuthService.ExchangeToken:output_type -> bytebase.v1.ExchangeTokenResponse
- 4, // 13: bytebase.v1.AuthService.Signup:output_type -> bytebase.v1.LoginResponse
- 10, // 14: bytebase.v1.AuthService.Refresh:output_type -> bytebase.v1.RefreshResponse
- 4, // 15: bytebase.v1.AuthService.SwitchWorkspace:output_type -> bytebase.v1.LoginResponse
- 10, // [10:16] is the sub-list for method output_type
- 4, // [4:10] is the sub-list for method input_type
+ 14, // 9: bytebase.v1.AuthService.SwitchWorkspace:input_type -> bytebase.v1.SwitchWorkspaceRequest
+ 11, // 10: bytebase.v1.AuthService.RequestPasswordReset:input_type -> bytebase.v1.RequestPasswordResetRequest
+ 12, // 11: bytebase.v1.AuthService.ResetPassword:input_type -> bytebase.v1.ResetPasswordRequest
+ 13, // 12: bytebase.v1.AuthService.SendEmailLoginCode:input_type -> bytebase.v1.SendEmailLoginCodeRequest
+ 4, // 13: bytebase.v1.AuthService.Login:output_type -> bytebase.v1.LoginResponse
+ 16, // 14: bytebase.v1.AuthService.Logout:output_type -> google.protobuf.Empty
+ 7, // 15: bytebase.v1.AuthService.ExchangeToken:output_type -> bytebase.v1.ExchangeTokenResponse
+ 4, // 16: bytebase.v1.AuthService.Signup:output_type -> bytebase.v1.LoginResponse
+ 10, // 17: bytebase.v1.AuthService.Refresh:output_type -> bytebase.v1.RefreshResponse
+ 4, // 18: bytebase.v1.AuthService.SwitchWorkspace:output_type -> bytebase.v1.LoginResponse
+ 16, // 19: bytebase.v1.AuthService.RequestPasswordReset:output_type -> google.protobuf.Empty
+ 16, // 20: bytebase.v1.AuthService.ResetPassword:output_type -> google.protobuf.Empty
+ 16, // 21: bytebase.v1.AuthService.SendEmailLoginCode:output_type -> google.protobuf.Empty
+ 13, // [13:22] is the sub-list for method output_type
+ 4, // [4:13] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name
4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
@@ -868,13 +1084,15 @@ func file_v1_auth_service_proto_init() {
}
file_v1_auth_service_proto_msgTypes[4].OneofWrappers = []any{}
file_v1_auth_service_proto_msgTypes[11].OneofWrappers = []any{}
+ file_v1_auth_service_proto_msgTypes[13].OneofWrappers = []any{}
+ file_v1_auth_service_proto_msgTypes[14].OneofWrappers = []any{}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_v1_auth_service_proto_rawDesc), len(file_v1_auth_service_proto_rawDesc)),
NumEnums: 0,
- NumMessages: 12,
+ NumMessages: 15,
NumExtensions: 0,
NumServices: 1,
},
diff --git a/backend/generated-go/v1/auth_service.pb.gw.go b/backend/generated-go/v1/auth_service.pb.gw.go
index b1cbfa2f0b..ae1e8148bd 100644
--- a/backend/generated-go/v1/auth_service.pb.gw.go
+++ b/backend/generated-go/v1/auth_service.pb.gw.go
@@ -197,6 +197,87 @@ func local_request_AuthService_SwitchWorkspace_0(ctx context.Context, marshaler
return msg, metadata, err
}
+func request_AuthService_RequestPasswordReset_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq RequestPasswordResetRequest
+ 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.RequestPasswordReset(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+}
+
+func local_request_AuthService_RequestPasswordReset_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq RequestPasswordResetRequest
+ 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.RequestPasswordReset(ctx, &protoReq)
+ return msg, metadata, err
+}
+
+func request_AuthService_ResetPassword_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq ResetPasswordRequest
+ 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.ResetPassword(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+}
+
+func local_request_AuthService_ResetPassword_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq ResetPasswordRequest
+ 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.ResetPassword(ctx, &protoReq)
+ return msg, metadata, err
+}
+
+func request_AuthService_SendEmailLoginCode_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq SendEmailLoginCodeRequest
+ 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.SendEmailLoginCode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+}
+
+func local_request_AuthService_SendEmailLoginCode_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq SendEmailLoginCodeRequest
+ 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.SendEmailLoginCode(ctx, &protoReq)
+ return msg, metadata, err
+}
+
// RegisterAuthServiceHandlerServer registers the http handlers for service AuthService to "mux".
// UnaryRPC :call AuthServiceServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
@@ -323,6 +404,66 @@ func RegisterAuthServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux
}
forward_AuthService_SwitchWorkspace_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
+ mux.Handle(http.MethodPost, pattern_AuthService_RequestPasswordReset_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, "/bytebase.v1.AuthService/RequestPasswordReset", runtime.WithHTTPPathPattern("/v1/auth:requestPasswordReset"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := local_request_AuthService_RequestPasswordReset_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_AuthService_RequestPasswordReset_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
+ mux.Handle(http.MethodPost, pattern_AuthService_ResetPassword_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, "/bytebase.v1.AuthService/ResetPassword", runtime.WithHTTPPathPattern("/v1/auth:resetPassword"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := local_request_AuthService_ResetPassword_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_AuthService_ResetPassword_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
+ mux.Handle(http.MethodPost, pattern_AuthService_SendEmailLoginCode_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, "/bytebase.v1.AuthService/SendEmailLoginCode", runtime.WithHTTPPathPattern("/v1/auth:sendEmailLoginCode"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := local_request_AuthService_SendEmailLoginCode_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_AuthService_SendEmailLoginCode_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
return nil
}
@@ -465,23 +606,80 @@ func RegisterAuthServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux
}
forward_AuthService_SwitchWorkspace_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
+ mux.Handle(http.MethodPost, pattern_AuthService_RequestPasswordReset_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, "/bytebase.v1.AuthService/RequestPasswordReset", runtime.WithHTTPPathPattern("/v1/auth:requestPasswordReset"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := request_AuthService_RequestPasswordReset_0(annotatedContext, inboundMarshaler, client, req, pathParams)
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ forward_AuthService_RequestPasswordReset_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
+ mux.Handle(http.MethodPost, pattern_AuthService_ResetPassword_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, "/bytebase.v1.AuthService/ResetPassword", runtime.WithHTTPPathPattern("/v1/auth:resetPassword"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := request_AuthService_ResetPassword_0(annotatedContext, inboundMarshaler, client, req, pathParams)
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ forward_AuthService_ResetPassword_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
+ mux.Handle(http.MethodPost, pattern_AuthService_SendEmailLoginCode_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, "/bytebase.v1.AuthService/SendEmailLoginCode", runtime.WithHTTPPathPattern("/v1/auth:sendEmailLoginCode"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := request_AuthService_SendEmailLoginCode_0(annotatedContext, inboundMarshaler, client, req, pathParams)
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ forward_AuthService_SendEmailLoginCode_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
return nil
}
var (
- pattern_AuthService_Login_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "auth", "login"}, ""))
- pattern_AuthService_Logout_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "auth", "logout"}, ""))
- pattern_AuthService_ExchangeToken_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "auth"}, "exchangeToken"))
- pattern_AuthService_Signup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "auth", "signup"}, ""))
- pattern_AuthService_Refresh_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "auth", "refresh"}, ""))
- pattern_AuthService_SwitchWorkspace_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "auth"}, "switchWorkspace"))
+ pattern_AuthService_Login_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "auth", "login"}, ""))
+ pattern_AuthService_Logout_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "auth", "logout"}, ""))
+ pattern_AuthService_ExchangeToken_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "auth"}, "exchangeToken"))
+ pattern_AuthService_Signup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "auth", "signup"}, ""))
+ pattern_AuthService_Refresh_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "auth", "refresh"}, ""))
+ pattern_AuthService_SwitchWorkspace_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "auth"}, "switchWorkspace"))
+ pattern_AuthService_RequestPasswordReset_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "auth"}, "requestPasswordReset"))
+ pattern_AuthService_ResetPassword_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "auth"}, "resetPassword"))
+ pattern_AuthService_SendEmailLoginCode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "auth"}, "sendEmailLoginCode"))
)
var (
- forward_AuthService_Login_0 = runtime.ForwardResponseMessage
- forward_AuthService_Logout_0 = runtime.ForwardResponseMessage
- forward_AuthService_ExchangeToken_0 = runtime.ForwardResponseMessage
- forward_AuthService_Signup_0 = runtime.ForwardResponseMessage
- forward_AuthService_Refresh_0 = runtime.ForwardResponseMessage
- forward_AuthService_SwitchWorkspace_0 = runtime.ForwardResponseMessage
+ forward_AuthService_Login_0 = runtime.ForwardResponseMessage
+ forward_AuthService_Logout_0 = runtime.ForwardResponseMessage
+ forward_AuthService_ExchangeToken_0 = runtime.ForwardResponseMessage
+ forward_AuthService_Signup_0 = runtime.ForwardResponseMessage
+ forward_AuthService_Refresh_0 = runtime.ForwardResponseMessage
+ forward_AuthService_SwitchWorkspace_0 = runtime.ForwardResponseMessage
+ forward_AuthService_RequestPasswordReset_0 = runtime.ForwardResponseMessage
+ forward_AuthService_ResetPassword_0 = runtime.ForwardResponseMessage
+ forward_AuthService_SendEmailLoginCode_0 = runtime.ForwardResponseMessage
)
diff --git a/backend/generated-go/v1/auth_service_equal.pb.go b/backend/generated-go/v1/auth_service_equal.pb.go
index 09f6623e36..6981560a00 100644
--- a/backend/generated-go/v1/auth_service_equal.pb.go
+++ b/backend/generated-go/v1/auth_service_equal.pb.go
@@ -34,6 +34,9 @@ func (x *LoginRequest) Equal(y *LoginRequest) bool {
if p, q := x.MfaTempToken, y.MfaTempToken; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) {
return false
}
+ if p, q := x.EmailCode, y.EmailCode; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) {
+ return false
+ }
return true
}
@@ -179,6 +182,57 @@ func (x *RefreshResponse) Equal(y *RefreshResponse) bool {
return true
}
+func (x *RequestPasswordResetRequest) Equal(y *RequestPasswordResetRequest) bool {
+ if x == y {
+ return true
+ }
+ if x == nil || y == nil {
+ return x == nil && y == nil
+ }
+ if x.Email != y.Email {
+ return false
+ }
+ if p, q := x.Workspace, y.Workspace; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) {
+ return false
+ }
+ return true
+}
+
+func (x *ResetPasswordRequest) Equal(y *ResetPasswordRequest) bool {
+ if x == y {
+ return true
+ }
+ if x == nil || y == nil {
+ return x == nil && y == nil
+ }
+ if x.Email != y.Email {
+ return false
+ }
+ if x.Code != y.Code {
+ return false
+ }
+ if x.NewPassword != y.NewPassword {
+ return false
+ }
+ return true
+}
+
+func (x *SendEmailLoginCodeRequest) Equal(y *SendEmailLoginCodeRequest) bool {
+ if x == y {
+ return true
+ }
+ if x == nil || y == nil {
+ return x == nil && y == nil
+ }
+ if x.Email != y.Email {
+ return false
+ }
+ if p, q := x.Workspace, y.Workspace; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) {
+ return false
+ }
+ return true
+}
+
func (x *SwitchWorkspaceRequest) Equal(y *SwitchWorkspaceRequest) bool {
if x == y {
return true
diff --git a/backend/generated-go/v1/auth_service_grpc.pb.go b/backend/generated-go/v1/auth_service_grpc.pb.go
index 52114bf089..81ff19045f 100644
--- a/backend/generated-go/v1/auth_service_grpc.pb.go
+++ b/backend/generated-go/v1/auth_service_grpc.pb.go
@@ -20,12 +20,15 @@ import (
const _ = grpc.SupportPackageIsVersion9
const (
- AuthService_Login_FullMethodName = "/bytebase.v1.AuthService/Login"
- AuthService_Logout_FullMethodName = "/bytebase.v1.AuthService/Logout"
- AuthService_ExchangeToken_FullMethodName = "/bytebase.v1.AuthService/ExchangeToken"
- AuthService_Signup_FullMethodName = "/bytebase.v1.AuthService/Signup"
- AuthService_Refresh_FullMethodName = "/bytebase.v1.AuthService/Refresh"
- AuthService_SwitchWorkspace_FullMethodName = "/bytebase.v1.AuthService/SwitchWorkspace"
+ AuthService_Login_FullMethodName = "/bytebase.v1.AuthService/Login"
+ AuthService_Logout_FullMethodName = "/bytebase.v1.AuthService/Logout"
+ AuthService_ExchangeToken_FullMethodName = "/bytebase.v1.AuthService/ExchangeToken"
+ AuthService_Signup_FullMethodName = "/bytebase.v1.AuthService/Signup"
+ AuthService_Refresh_FullMethodName = "/bytebase.v1.AuthService/Refresh"
+ AuthService_SwitchWorkspace_FullMethodName = "/bytebase.v1.AuthService/SwitchWorkspace"
+ AuthService_RequestPasswordReset_FullMethodName = "/bytebase.v1.AuthService/RequestPasswordReset"
+ AuthService_ResetPassword_FullMethodName = "/bytebase.v1.AuthService/ResetPassword"
+ AuthService_SendEmailLoginCode_FullMethodName = "/bytebase.v1.AuthService/SendEmailLoginCode"
)
// AuthServiceClient is the client API for AuthService service.
@@ -55,6 +58,17 @@ type AuthServiceClient interface {
// Switches the current user's active workspace and issues new tokens.
// The user must be a member of the target workspace.
SwitchWorkspace(ctx context.Context, in *SwitchWorkspaceRequest, opts ...grpc.CallOption) (*LoginResponse, error)
+ // Requests a password reset email for the given email address.
+ // Always returns success to avoid leaking whether the email exists.
+ // Permissions required: None
+ RequestPasswordReset(ctx context.Context, in *RequestPasswordResetRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
+ // Resets the user's password using a password reset token from email.
+ // Permissions required: None (validates via token)
+ ResetPassword(ctx context.Context, in *ResetPasswordRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
+ // Sends a 6-digit verification code to the email for login/signup.
+ // Always returns success (no email enumeration). Enforces 60-sec resend cooldown.
+ // Permissions required: None
+ SendEmailLoginCode(ctx context.Context, in *SendEmailLoginCodeRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
}
type authServiceClient struct {
@@ -125,6 +139,36 @@ func (c *authServiceClient) SwitchWorkspace(ctx context.Context, in *SwitchWorks
return out, nil
}
+func (c *authServiceClient) RequestPasswordReset(ctx context.Context, in *RequestPasswordResetRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(emptypb.Empty)
+ err := c.cc.Invoke(ctx, AuthService_RequestPasswordReset_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *authServiceClient) ResetPassword(ctx context.Context, in *ResetPasswordRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(emptypb.Empty)
+ err := c.cc.Invoke(ctx, AuthService_ResetPassword_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *authServiceClient) SendEmailLoginCode(ctx context.Context, in *SendEmailLoginCodeRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(emptypb.Empty)
+ err := c.cc.Invoke(ctx, AuthService_SendEmailLoginCode_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
// AuthServiceServer is the server API for AuthService service.
// All implementations must embed UnimplementedAuthServiceServer
// for forward compatibility.
@@ -152,6 +196,17 @@ type AuthServiceServer interface {
// Switches the current user's active workspace and issues new tokens.
// The user must be a member of the target workspace.
SwitchWorkspace(context.Context, *SwitchWorkspaceRequest) (*LoginResponse, error)
+ // Requests a password reset email for the given email address.
+ // Always returns success to avoid leaking whether the email exists.
+ // Permissions required: None
+ RequestPasswordReset(context.Context, *RequestPasswordResetRequest) (*emptypb.Empty, error)
+ // Resets the user's password using a password reset token from email.
+ // Permissions required: None (validates via token)
+ ResetPassword(context.Context, *ResetPasswordRequest) (*emptypb.Empty, error)
+ // Sends a 6-digit verification code to the email for login/signup.
+ // Always returns success (no email enumeration). Enforces 60-sec resend cooldown.
+ // Permissions required: None
+ SendEmailLoginCode(context.Context, *SendEmailLoginCodeRequest) (*emptypb.Empty, error)
mustEmbedUnimplementedAuthServiceServer()
}
@@ -180,6 +235,15 @@ func (UnimplementedAuthServiceServer) Refresh(context.Context, *RefreshRequest)
func (UnimplementedAuthServiceServer) SwitchWorkspace(context.Context, *SwitchWorkspaceRequest) (*LoginResponse, error) {
return nil, status.Error(codes.Unimplemented, "method SwitchWorkspace not implemented")
}
+func (UnimplementedAuthServiceServer) RequestPasswordReset(context.Context, *RequestPasswordResetRequest) (*emptypb.Empty, error) {
+ return nil, status.Error(codes.Unimplemented, "method RequestPasswordReset not implemented")
+}
+func (UnimplementedAuthServiceServer) ResetPassword(context.Context, *ResetPasswordRequest) (*emptypb.Empty, error) {
+ return nil, status.Error(codes.Unimplemented, "method ResetPassword not implemented")
+}
+func (UnimplementedAuthServiceServer) SendEmailLoginCode(context.Context, *SendEmailLoginCodeRequest) (*emptypb.Empty, error) {
+ return nil, status.Error(codes.Unimplemented, "method SendEmailLoginCode not implemented")
+}
func (UnimplementedAuthServiceServer) mustEmbedUnimplementedAuthServiceServer() {}
func (UnimplementedAuthServiceServer) testEmbeddedByValue() {}
@@ -309,6 +373,60 @@ func _AuthService_SwitchWorkspace_Handler(srv interface{}, ctx context.Context,
return interceptor(ctx, in, info, handler)
}
+func _AuthService_RequestPasswordReset_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(RequestPasswordResetRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(AuthServiceServer).RequestPasswordReset(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: AuthService_RequestPasswordReset_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(AuthServiceServer).RequestPasswordReset(ctx, req.(*RequestPasswordResetRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _AuthService_ResetPassword_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(ResetPasswordRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(AuthServiceServer).ResetPassword(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: AuthService_ResetPassword_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(AuthServiceServer).ResetPassword(ctx, req.(*ResetPasswordRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _AuthService_SendEmailLoginCode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(SendEmailLoginCodeRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(AuthServiceServer).SendEmailLoginCode(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: AuthService_SendEmailLoginCode_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(AuthServiceServer).SendEmailLoginCode(ctx, req.(*SendEmailLoginCodeRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
// AuthService_ServiceDesc is the grpc.ServiceDesc for AuthService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@@ -340,6 +458,18 @@ var AuthService_ServiceDesc = grpc.ServiceDesc{
MethodName: "SwitchWorkspace",
Handler: _AuthService_SwitchWorkspace_Handler,
},
+ {
+ MethodName: "RequestPasswordReset",
+ Handler: _AuthService_RequestPasswordReset_Handler,
+ },
+ {
+ MethodName: "ResetPassword",
+ Handler: _AuthService_ResetPassword_Handler,
+ },
+ {
+ MethodName: "SendEmailLoginCode",
+ Handler: _AuthService_SendEmailLoginCode_Handler,
+ },
},
Streams: []grpc.StreamDesc{},
Metadata: "v1/auth_service.proto",
diff --git a/backend/generated-go/v1/setting_service.pb.go b/backend/generated-go/v1/setting_service.pb.go
index f718aa54a7..ecc5f1e34d 100644
--- a/backend/generated-go/v1/setting_service.pb.go
+++ b/backend/generated-go/v1/setting_service.pb.go
@@ -1080,9 +1080,12 @@ type WorkspaceProfileSetting struct {
// The default value is 100MB, we will use the default value if the setting not exists, or the limit <= 0.
SqlResultSize int64 `protobuf:"varint,20,opt,name=sql_result_size,json=sqlResultSize,proto3" json:"sql_result_size,omitempty"`
// The query timeout duration for query and export, works for the SQL Editor and Export Center.
- QueryTimeout *durationpb.Duration `protobuf:"bytes,21,opt,name=query_timeout,json=queryTimeout,proto3" json:"query_timeout,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
+ QueryTimeout *durationpb.Duration `protobuf:"bytes,21,opt,name=query_timeout,json=queryTimeout,proto3" json:"query_timeout,omitempty"`
+ // Allow signin/signup using email + a 6-digit one-time verification code.
+ // Requires the EMAIL setting to be configured on the workspace.
+ AllowEmailCodeSignin bool `protobuf:"varint,22,opt,name=allow_email_code_signin,json=allowEmailCodeSignin,proto3" json:"allow_email_code_signin,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
}
func (x *WorkspaceProfileSetting) Reset() {
@@ -1255,6 +1258,13 @@ func (x *WorkspaceProfileSetting) GetQueryTimeout() *durationpb.Duration {
return nil
}
+func (x *WorkspaceProfileSetting) GetAllowEmailCodeSignin() bool {
+ if x != nil {
+ return x.AllowEmailCodeSignin
+ }
+ return false
+}
+
type Announcement struct {
state protoimpl.MessageState `protogen:"open.v1"`
// The alert level of announcement
@@ -3348,7 +3358,7 @@ const file_v1_setting_service_proto_rawDesc = "" +
"\x04lark\x18\x05 \x01(\v2\x1e.bytebase.v1.AppIMSetting.LarkH\x00R\x04lark\x12@\n" +
"\bdingtalk\x18\x06 \x01(\v2\".bytebase.v1.AppIMSetting.DingTalkH\x00R\bdingtalk\x127\n" +
"\x05teams\x18\a \x01(\v2\x1f.bytebase.v1.AppIMSetting.TeamsH\x00R\x05teamsB\t\n" +
- "\apayload\"\xc1\f\n" +
+ "\apayload\"\xf8\f\n" +
"\x17WorkspaceProfileSetting\x12!\n" +
"\fexternal_url\x18\x01 \x01(\tR\vexternalUrl\x12'\n" +
"\x0fdisallow_signup\x18\x02 \x01(\bR\x0edisallowSignup\x12\x1f\n" +
@@ -3371,7 +3381,8 @@ const file_v1_setting_service_proto_rawDesc = "" +
"\x15access_token_duration\x18\x12 \x01(\v2\x19.google.protobuf.DurationR\x13accessTokenDuration\x12!\n" +
"\fenable_debug\x18\x13 \x01(\bR\venableDebug\x12&\n" +
"\x0fsql_result_size\x18\x14 \x01(\x03R\rsqlResultSize\x12>\n" +
- "\rquery_timeout\x18\x15 \x01(\v2\x19.google.protobuf.DurationR\fqueryTimeout\x1a\x93\x03\n" +
+ "\rquery_timeout\x18\x15 \x01(\v2\x19.google.protobuf.DurationR\fqueryTimeout\x125\n" +
+ "\x17allow_email_code_signin\x18\x16 \x01(\bR\x14allowEmailCodeSignin\x1a\x93\x03\n" +
"\x13PasswordRestriction\x12\x1d\n" +
"\n" +
"min_length\x18\x01 \x01(\x05R\tminLength\x12%\n" +
diff --git a/backend/generated-go/v1/setting_service_equal.pb.go b/backend/generated-go/v1/setting_service_equal.pb.go
index 518eac32d2..75892be72c 100644
--- a/backend/generated-go/v1/setting_service_equal.pb.go
+++ b/backend/generated-go/v1/setting_service_equal.pb.go
@@ -393,6 +393,9 @@ func (x *WorkspaceProfileSetting) Equal(y *WorkspaceProfileSetting) bool {
if p, q := x.QueryTimeout, y.QueryTimeout; (p == nil && q != nil) || (p != nil && (q == nil || p.Seconds != q.Seconds || p.Nanos != q.Nanos)) {
return false
}
+ if x.AllowEmailCodeSignin != y.AllowEmailCodeSignin {
+ return false
+ }
return true
}
diff --git a/backend/generated-go/v1/v1connect/auth_service.connect.go b/backend/generated-go/v1/v1connect/auth_service.connect.go
index 671bb6bc8d..d381f827a1 100644
--- a/backend/generated-go/v1/v1connect/auth_service.connect.go
+++ b/backend/generated-go/v1/v1connect/auth_service.connect.go
@@ -48,6 +48,15 @@ const (
// AuthServiceSwitchWorkspaceProcedure is the fully-qualified name of the AuthService's
// SwitchWorkspace RPC.
AuthServiceSwitchWorkspaceProcedure = "/bytebase.v1.AuthService/SwitchWorkspace"
+ // AuthServiceRequestPasswordResetProcedure is the fully-qualified name of the AuthService's
+ // RequestPasswordReset RPC.
+ AuthServiceRequestPasswordResetProcedure = "/bytebase.v1.AuthService/RequestPasswordReset"
+ // AuthServiceResetPasswordProcedure is the fully-qualified name of the AuthService's ResetPassword
+ // RPC.
+ AuthServiceResetPasswordProcedure = "/bytebase.v1.AuthService/ResetPassword"
+ // AuthServiceSendEmailLoginCodeProcedure is the fully-qualified name of the AuthService's
+ // SendEmailLoginCode RPC.
+ AuthServiceSendEmailLoginCodeProcedure = "/bytebase.v1.AuthService/SendEmailLoginCode"
)
// AuthServiceClient is a client for the bytebase.v1.AuthService service.
@@ -73,6 +82,17 @@ type AuthServiceClient interface {
// Switches the current user's active workspace and issues new tokens.
// The user must be a member of the target workspace.
SwitchWorkspace(context.Context, *connect.Request[v1.SwitchWorkspaceRequest]) (*connect.Response[v1.LoginResponse], error)
+ // Requests a password reset email for the given email address.
+ // Always returns success to avoid leaking whether the email exists.
+ // Permissions required: None
+ RequestPasswordReset(context.Context, *connect.Request[v1.RequestPasswordResetRequest]) (*connect.Response[emptypb.Empty], error)
+ // Resets the user's password using a password reset token from email.
+ // Permissions required: None (validates via token)
+ ResetPassword(context.Context, *connect.Request[v1.ResetPasswordRequest]) (*connect.Response[emptypb.Empty], error)
+ // Sends a 6-digit verification code to the email for login/signup.
+ // Always returns success (no email enumeration). Enforces 60-sec resend cooldown.
+ // Permissions required: None
+ SendEmailLoginCode(context.Context, *connect.Request[v1.SendEmailLoginCodeRequest]) (*connect.Response[emptypb.Empty], error)
}
// NewAuthServiceClient constructs a client for the bytebase.v1.AuthService service. By default, it
@@ -122,17 +142,38 @@ func NewAuthServiceClient(httpClient connect.HTTPClient, baseURL string, opts ..
connect.WithSchema(authServiceMethods.ByName("SwitchWorkspace")),
connect.WithClientOptions(opts...),
),
+ requestPasswordReset: connect.NewClient[v1.RequestPasswordResetRequest, emptypb.Empty](
+ httpClient,
+ baseURL+AuthServiceRequestPasswordResetProcedure,
+ connect.WithSchema(authServiceMethods.ByName("RequestPasswordReset")),
+ connect.WithClientOptions(opts...),
+ ),
+ resetPassword: connect.NewClient[v1.ResetPasswordRequest, emptypb.Empty](
+ httpClient,
+ baseURL+AuthServiceResetPasswordProcedure,
+ connect.WithSchema(authServiceMethods.ByName("ResetPassword")),
+ connect.WithClientOptions(opts...),
+ ),
+ sendEmailLoginCode: connect.NewClient[v1.SendEmailLoginCodeRequest, emptypb.Empty](
+ httpClient,
+ baseURL+AuthServiceSendEmailLoginCodeProcedure,
+ connect.WithSchema(authServiceMethods.ByName("SendEmailLoginCode")),
+ connect.WithClientOptions(opts...),
+ ),
}
}
// authServiceClient implements AuthServiceClient.
type authServiceClient struct {
- login *connect.Client[v1.LoginRequest, v1.LoginResponse]
- logout *connect.Client[v1.LogoutRequest, emptypb.Empty]
- exchangeToken *connect.Client[v1.ExchangeTokenRequest, v1.ExchangeTokenResponse]
- signup *connect.Client[v1.SignupRequest, v1.LoginResponse]
- refresh *connect.Client[v1.RefreshRequest, v1.RefreshResponse]
- switchWorkspace *connect.Client[v1.SwitchWorkspaceRequest, v1.LoginResponse]
+ login *connect.Client[v1.LoginRequest, v1.LoginResponse]
+ logout *connect.Client[v1.LogoutRequest, emptypb.Empty]
+ exchangeToken *connect.Client[v1.ExchangeTokenRequest, v1.ExchangeTokenResponse]
+ signup *connect.Client[v1.SignupRequest, v1.LoginResponse]
+ refresh *connect.Client[v1.RefreshRequest, v1.RefreshResponse]
+ switchWorkspace *connect.Client[v1.SwitchWorkspaceRequest, v1.LoginResponse]
+ requestPasswordReset *connect.Client[v1.RequestPasswordResetRequest, emptypb.Empty]
+ resetPassword *connect.Client[v1.ResetPasswordRequest, emptypb.Empty]
+ sendEmailLoginCode *connect.Client[v1.SendEmailLoginCodeRequest, emptypb.Empty]
}
// Login calls bytebase.v1.AuthService.Login.
@@ -165,6 +206,21 @@ func (c *authServiceClient) SwitchWorkspace(ctx context.Context, req *connect.Re
return c.switchWorkspace.CallUnary(ctx, req)
}
+// RequestPasswordReset calls bytebase.v1.AuthService.RequestPasswordReset.
+func (c *authServiceClient) RequestPasswordReset(ctx context.Context, req *connect.Request[v1.RequestPasswordResetRequest]) (*connect.Response[emptypb.Empty], error) {
+ return c.requestPasswordReset.CallUnary(ctx, req)
+}
+
+// ResetPassword calls bytebase.v1.AuthService.ResetPassword.
+func (c *authServiceClient) ResetPassword(ctx context.Context, req *connect.Request[v1.ResetPasswordRequest]) (*connect.Response[emptypb.Empty], error) {
+ return c.resetPassword.CallUnary(ctx, req)
+}
+
+// SendEmailLoginCode calls bytebase.v1.AuthService.SendEmailLoginCode.
+func (c *authServiceClient) SendEmailLoginCode(ctx context.Context, req *connect.Request[v1.SendEmailLoginCodeRequest]) (*connect.Response[emptypb.Empty], error) {
+ return c.sendEmailLoginCode.CallUnary(ctx, req)
+}
+
// AuthServiceHandler is an implementation of the bytebase.v1.AuthService service.
type AuthServiceHandler interface {
// Authenticates a user and returns access tokens.
@@ -188,6 +244,17 @@ type AuthServiceHandler interface {
// Switches the current user's active workspace and issues new tokens.
// The user must be a member of the target workspace.
SwitchWorkspace(context.Context, *connect.Request[v1.SwitchWorkspaceRequest]) (*connect.Response[v1.LoginResponse], error)
+ // Requests a password reset email for the given email address.
+ // Always returns success to avoid leaking whether the email exists.
+ // Permissions required: None
+ RequestPasswordReset(context.Context, *connect.Request[v1.RequestPasswordResetRequest]) (*connect.Response[emptypb.Empty], error)
+ // Resets the user's password using a password reset token from email.
+ // Permissions required: None (validates via token)
+ ResetPassword(context.Context, *connect.Request[v1.ResetPasswordRequest]) (*connect.Response[emptypb.Empty], error)
+ // Sends a 6-digit verification code to the email for login/signup.
+ // Always returns success (no email enumeration). Enforces 60-sec resend cooldown.
+ // Permissions required: None
+ SendEmailLoginCode(context.Context, *connect.Request[v1.SendEmailLoginCodeRequest]) (*connect.Response[emptypb.Empty], error)
}
// NewAuthServiceHandler builds an HTTP handler from the service implementation. It returns the path
@@ -233,6 +300,24 @@ func NewAuthServiceHandler(svc AuthServiceHandler, opts ...connect.HandlerOption
connect.WithSchema(authServiceMethods.ByName("SwitchWorkspace")),
connect.WithHandlerOptions(opts...),
)
+ authServiceRequestPasswordResetHandler := connect.NewUnaryHandler(
+ AuthServiceRequestPasswordResetProcedure,
+ svc.RequestPasswordReset,
+ connect.WithSchema(authServiceMethods.ByName("RequestPasswordReset")),
+ connect.WithHandlerOptions(opts...),
+ )
+ authServiceResetPasswordHandler := connect.NewUnaryHandler(
+ AuthServiceResetPasswordProcedure,
+ svc.ResetPassword,
+ connect.WithSchema(authServiceMethods.ByName("ResetPassword")),
+ connect.WithHandlerOptions(opts...),
+ )
+ authServiceSendEmailLoginCodeHandler := connect.NewUnaryHandler(
+ AuthServiceSendEmailLoginCodeProcedure,
+ svc.SendEmailLoginCode,
+ connect.WithSchema(authServiceMethods.ByName("SendEmailLoginCode")),
+ connect.WithHandlerOptions(opts...),
+ )
return "/bytebase.v1.AuthService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
case AuthServiceLoginProcedure:
@@ -247,6 +332,12 @@ func NewAuthServiceHandler(svc AuthServiceHandler, opts ...connect.HandlerOption
authServiceRefreshHandler.ServeHTTP(w, r)
case AuthServiceSwitchWorkspaceProcedure:
authServiceSwitchWorkspaceHandler.ServeHTTP(w, r)
+ case AuthServiceRequestPasswordResetProcedure:
+ authServiceRequestPasswordResetHandler.ServeHTTP(w, r)
+ case AuthServiceResetPasswordProcedure:
+ authServiceResetPasswordHandler.ServeHTTP(w, r)
+ case AuthServiceSendEmailLoginCodeProcedure:
+ authServiceSendEmailLoginCodeHandler.ServeHTTP(w, r)
default:
http.NotFound(w, r)
}
@@ -279,3 +370,15 @@ func (UnimplementedAuthServiceHandler) Refresh(context.Context, *connect.Request
func (UnimplementedAuthServiceHandler) SwitchWorkspace(context.Context, *connect.Request[v1.SwitchWorkspaceRequest]) (*connect.Response[v1.LoginResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("bytebase.v1.AuthService.SwitchWorkspace is not implemented"))
}
+
+func (UnimplementedAuthServiceHandler) RequestPasswordReset(context.Context, *connect.Request[v1.RequestPasswordResetRequest]) (*connect.Response[emptypb.Empty], error) {
+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("bytebase.v1.AuthService.RequestPasswordReset is not implemented"))
+}
+
+func (UnimplementedAuthServiceHandler) ResetPassword(context.Context, *connect.Request[v1.ResetPasswordRequest]) (*connect.Response[emptypb.Empty], error) {
+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("bytebase.v1.AuthService.ResetPassword is not implemented"))
+}
+
+func (UnimplementedAuthServiceHandler) SendEmailLoginCode(context.Context, *connect.Request[v1.SendEmailLoginCodeRequest]) (*connect.Response[emptypb.Empty], error) {
+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("bytebase.v1.AuthService.SendEmailLoginCode is not implemented"))
+}
diff --git a/docs/superpowers/plans/2026-04-14-email-code-signin.md b/docs/superpowers/plans/2026-04-14-email-code-signin.md
new file mode 100644
index 0000000000..c18b908e16
--- /dev/null
+++ b/docs/superpowers/plans/2026-04-14-email-code-signin.md
@@ -0,0 +1,1864 @@
+# Email + 6-Digit Code Signin Implementation Plan
+
+> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
+
+**Goal:** Add passwordless signin/signup via email + 6-digit code, and refactor password reset onto the same mechanism.
+
+**Architecture:** A new `email_verification_code` table (PK = `email`, `purpose`) backs both flows. Login gains an `email_code` field in `LoginRequest`, threading through the existing workspace/MFA/token pipeline. Password reset switches from JWT to DB-backed code with cooldown + attempt limits, making it HA-safe.
+
+**Tech Stack:** Go stdlib (`crypto/rand`, `crypto/sha256`, `crypto/subtle`), Connect-RPC, protobuf, PostgreSQL, Vue 3.
+
+**Spec:** `docs/superpowers/specs/2026-04-14-email-code-signin-design.md`
+
+---
+
+### Task 1: Store proto — EmailVerificationCodePurpose enum
+
+**Files:**
+- Create: `proto/store/store/email_verification_code.proto`
+
+- [ ] **Step 1: Create the proto file**
+
+```proto
+syntax = "proto3";
+
+package bytebase.store;
+
+option go_package = "generated-go/store";
+
+// EmailVerificationCodePurpose distinguishes login codes from password reset codes.
+// Stored as the enum name string in email_verification_code.purpose column.
+enum EmailVerificationCodePurpose {
+ EMAIL_VERIFICATION_CODE_PURPOSE_UNSPECIFIED = 0;
+ LOGIN = 1;
+ PASSWORD_RESET = 2;
+}
+```
+
+- [ ] **Step 2: Format and lint**
+
+```bash
+cd proto && buf format -w . && buf lint
+```
+
+Expected: no errors.
+
+---
+
+### Task 2: Store proto — add allow_email_code_signin to WorkspaceProfileSetting
+
+**Files:**
+- Modify: `proto/store/store/setting.proto:37-147` (WorkspaceProfileSetting message)
+
+- [ ] **Step 1: Add field before closing `}` at line 147**
+
+Find the last field (around `query_timeout` at line 146) and the closing brace at line 147. Insert a new field:
+
+```proto
+ // Allow signin/signup using email + a 6-digit one-time verification code.
+ // Requires the EMAIL setting to be configured on the workspace.
+ bool allow_email_code_signin = 22;
+```
+
+(Use the next available field number; check the highest existing number in the message and use next.)
+
+- [ ] **Step 2: Format and lint**
+
+```bash
+cd proto && buf format -w . && buf lint
+```
+
+Expected: no errors.
+
+---
+
+### Task 3: V1 proto — mirror allow_email_code_signin to setting_service + Restriction
+
+**Files:**
+- Modify: `proto/v1/v1/setting_service.proto:185-267` (WorkspaceProfileSetting)
+- Modify: `proto/v1/v1/actuator_service.proto:65-74` (Restriction)
+
+- [ ] **Step 1: Add field to v1 WorkspaceProfileSetting (before closing `}` at line 267)**
+
+```proto
+ // Allow signin/signup using email + a 6-digit one-time verification code.
+ // Requires the EMAIL setting to be configured on the workspace.
+ bool allow_email_code_signin = 22;
+```
+
+(Use the next available field number matching the store proto.)
+
+- [ ] **Step 2: Add field to Restriction message**
+
+Replace the Restriction message (lines 65-74) with:
+
+```proto
+message Restriction {
+ // Whether self-service user signup is disabled.
+ bool disallow_signup = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
+
+ // Whether password-based signin is disabled (except for workspace admins).
+ bool disallow_password_signin = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
+
+ // Password complexity and restriction requirements.
+ WorkspaceProfileSetting.PasswordRestriction password_restriction = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
+
+ // Whether email + 6-digit code signin is enabled for this workspace.
+ bool allow_email_code_signin = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
+}
+```
+
+- [ ] **Step 3: Format and lint**
+
+```bash
+cd proto && buf format -w . && buf lint
+```
+
+Expected: no errors.
+
+---
+
+### Task 4: V1 proto — add email_code to LoginRequest and SendEmailLoginCode RPC; switch ResetPassword to code
+
+**Files:**
+- Modify: `proto/v1/v1/auth_service.proto`
+
+- [ ] **Step 1: Add `email_code` field to LoginRequest**
+
+Find `LoginRequest` (lines 103-129). Add a new field after `mfa_temp_token` (field 8):
+
+```proto
+ // 6-digit code from email for passwordless login/signup.
+ // Pairs with `email`. Mutually exclusive with `password` and `idp_name`.
+ optional string email_code = 9;
+```
+
+- [ ] **Step 2: Add SendEmailLoginCode RPC to AuthService**
+
+Inside the `service AuthService { ... }` block, add before the closing `}`:
+
+```proto
+ // Sends a 6-digit verification code to the email for login/signup.
+ // Always returns success (no email enumeration). Enforces 60-sec resend cooldown.
+ // Permissions required: None
+ rpc SendEmailLoginCode(SendEmailLoginCodeRequest) returns (google.protobuf.Empty) {
+ option (google.api.http) = {
+ post: "/v1/auth:sendEmailLoginCode"
+ body: "*"
+ };
+ option (bytebase.v1.allow_without_credential) = true;
+ option (bytebase.v1.audit) = true;
+ }
+```
+
+- [ ] **Step 3: Add SendEmailLoginCodeRequest message**
+
+Append at the end of the file (before the final `}` if any, or at bottom):
+
+```proto
+message SendEmailLoginCodeRequest {
+ // The email address to send the code to.
+ string email = 1;
+}
+```
+
+- [ ] **Step 4: Replace ResetPasswordRequest message**
+
+Find the existing `ResetPasswordRequest` message (added in earlier work). Replace:
+
+```proto
+message ResetPasswordRequest {
+ // The email address of the account.
+ string email = 1;
+ // The 6-digit code from the reset email.
+ string code = 2;
+ // The new password to set.
+ string new_password = 3;
+}
+```
+
+- [ ] **Step 5: Format, lint, generate**
+
+```bash
+cd proto && buf format -w . && buf lint && buf generate
+```
+
+Expected: no errors. All generated files (backend/generated-go/, frontend/src/types/proto-es/) are updated.
+
+---
+
+### Task 5: Database migration — email_verification_code table
+
+**Files:**
+- Create: `backend/migrator/migration/3.18/0000_add_email_verification_code.sql`
+- Modify: `backend/migrator/migration/LATEST.sql` (insert new CREATE TABLE)
+- Modify: `backend/migrator/migrator_test.go` (`TestLatestVersion`)
+
+- [ ] **Step 1: Create the migration file**
+
+File: `backend/migrator/migration/3.18/0000_add_email_verification_code.sql`
+
+```sql
+CREATE TABLE email_verification_code (
+ email text NOT NULL,
+ -- Stored as EmailVerificationCodePurpose enum name (proto/store/store/email_verification_code.proto)
+ purpose text NOT NULL,
+ code_hash text NOT NULL,
+ attempts int NOT NULL DEFAULT 0,
+ expires_at timestamptz NOT NULL,
+ last_sent_at timestamptz NOT NULL,
+ PRIMARY KEY (email, purpose)
+);
+
+CREATE INDEX idx_email_verification_code_expires_at ON email_verification_code (expires_at);
+```
+
+- [ ] **Step 2: Mirror in LATEST.sql**
+
+Open `backend/migrator/migration/LATEST.sql`. Find the `web_refresh_token` CREATE TABLE (around line 631-638). Immediately after its trailing `CREATE INDEX` statements, append:
+
+```sql
+
+CREATE TABLE email_verification_code (
+ email text NOT NULL,
+ -- Stored as EmailVerificationCodePurpose enum name (proto/store/store/email_verification_code.proto)
+ purpose text NOT NULL,
+ code_hash text NOT NULL,
+ attempts int NOT NULL DEFAULT 0,
+ expires_at timestamptz NOT NULL,
+ last_sent_at timestamptz NOT NULL,
+ PRIMARY KEY (email, purpose)
+);
+
+CREATE INDEX idx_email_verification_code_expires_at ON email_verification_code (expires_at);
+```
+
+- [ ] **Step 3: Bump TestLatestVersion**
+
+Open `backend/migrator/migrator_test.go`. Find `TestLatestVersion`. Update the expected version to `3.18` (or match the new directory you created).
+
+- [ ] **Step 4: Run migrator test**
+
+```bash
+go test -v -count=1 -run TestLatestVersion github.com/bytebase/bytebase/backend/migrator
+```
+
+Expected: PASS.
+
+---
+
+### Task 6: Store layer — email_verification_code.go
+
+**Files:**
+- Create: `backend/store/email_verification_code.go`
+- Create: `backend/store/email_verification_code_test.go`
+
+- [ ] **Step 1: Write the failing test**
+
+File: `backend/store/email_verification_code_test.go`
+
+```go
+package store
+
+import (
+ "testing"
+ "time"
+
+ "github.com/stretchr/testify/assert"
+ "github.com/stretchr/testify/require"
+
+ storepb "github.com/bytebase/bytebase/backend/generated-go/store"
+)
+
+func TestEmailVerificationCode_UpsertGet(t *testing.T) {
+ ctx := t.Context()
+ s := setupStoreForTest(t)
+
+ code := &EmailVerificationCodeMessage{
+ Email: "[email protected]",
+ Purpose: storepb.EmailVerificationCodePurpose_LOGIN,
+ CodeHash: "hash1",
+ ExpiresAt: time.Now().Add(10 * time.Minute),
+ LastSentAt: time.Now(),
+ }
+ require.NoError(t, s.UpsertEmailVerificationCode(ctx, code))
+
+ got, err := s.GetEmailVerificationCode(ctx, code.Email, code.Purpose)
+ require.NoError(t, err)
+ require.NotNil(t, got)
+ assert.Equal(t, code.Email, got.Email)
+ assert.Equal(t, code.Purpose, got.Purpose)
+ assert.Equal(t, code.CodeHash, got.CodeHash)
+ assert.Equal(t, 0, got.Attempts)
+}
+
+func TestEmailVerificationCode_UpsertReplacesAttempts(t *testing.T) {
+ ctx := t.Context()
+ s := setupStoreForTest(t)
+
+ first := &EmailVerificationCodeMessage{
+ Email: "[email protected]",
+ Purpose: storepb.EmailVerificationCodePurpose_LOGIN,
+ CodeHash: "hash1",
+ ExpiresAt: time.Now().Add(10 * time.Minute),
+ LastSentAt: time.Now(),
+ }
+ require.NoError(t, s.UpsertEmailVerificationCode(ctx, first))
+ require.NoError(t, s.IncrementEmailVerificationCodeAttempts(ctx, first.Email, first.Purpose))
+ require.NoError(t, s.IncrementEmailVerificationCodeAttempts(ctx, first.Email, first.Purpose))
+
+ second := &EmailVerificationCodeMessage{
+ Email: first.Email,
+ Purpose: first.Purpose,
+ CodeHash: "hash2",
+ ExpiresAt: time.Now().Add(10 * time.Minute),
+ LastSentAt: time.Now(),
+ }
+ require.NoError(t, s.UpsertEmailVerificationCode(ctx, second))
+
+ got, err := s.GetEmailVerificationCode(ctx, second.Email, second.Purpose)
+ require.NoError(t, err)
+ assert.Equal(t, "hash2", got.CodeHash)
+ assert.Equal(t, 0, got.Attempts, "upsert should reset attempts")
+}
+
+func TestEmailVerificationCode_PurposesCoexist(t *testing.T) {
+ ctx := t.Context()
+ s := setupStoreForTest(t)
+
+ require.NoError(t, s.UpsertEmailVerificationCode(ctx, &EmailVerificationCodeMessage{
+ Email: "[email protected]", Purpose: storepb.EmailVerificationCodePurpose_LOGIN,
+ CodeHash: "login-hash", ExpiresAt: time.Now().Add(time.Minute), LastSentAt: time.Now(),
+ }))
+ require.NoError(t, s.UpsertEmailVerificationCode(ctx, &EmailVerificationCodeMessage{
+ Email: "[email protected]", Purpose: storepb.EmailVerificationCodePurpose_PASSWORD_RESET,
+ CodeHash: "reset-hash", ExpiresAt: time.Now().Add(time.Minute), LastSentAt: time.Now(),
+ }))
+
+ loginRow, _ := s.GetEmailVerificationCode(ctx, "[email protected]", storepb.EmailVerificationCodePurpose_LOGIN)
+ resetRow, _ := s.GetEmailVerificationCode(ctx, "[email protected]", storepb.EmailVerificationCodePurpose_PASSWORD_RESET)
+ require.NotNil(t, loginRow)
+ require.NotNil(t, resetRow)
+ assert.Equal(t, "login-hash", loginRow.CodeHash)
+ assert.Equal(t, "reset-hash", resetRow.CodeHash)
+}
+
+func TestEmailVerificationCode_Delete(t *testing.T) {
+ ctx := t.Context()
+ s := setupStoreForTest(t)
+
+ require.NoError(t, s.UpsertEmailVerificationCode(ctx, &EmailVerificationCodeMessage{
+ Email: "[email protected]", Purpose: storepb.EmailVerificationCodePurpose_LOGIN,
+ CodeHash: "h", ExpiresAt: time.Now().Add(time.Minute), LastSentAt: time.Now(),
+ }))
+ require.NoError(t, s.DeleteEmailVerificationCode(ctx, "[email protected]", storepb.EmailVerificationCodePurpose_LOGIN))
+
+ got, err := s.GetEmailVerificationCode(ctx, "[email protected]", storepb.EmailVerificationCodePurpose_LOGIN)
+ require.NoError(t, err)
+ assert.Nil(t, got)
+}
+
+func TestEmailVerificationCode_DeleteExpired(t *testing.T) {
+ ctx := t.Context()
+ s := setupStoreForTest(t)
+
+ // Expired row.
+ require.NoError(t, s.UpsertEmailVerificationCode(ctx, &EmailVerificationCodeMessage{
+ Email: "[email protected]", Purpose: storepb.EmailVerificationCodePurpose_LOGIN,
+ CodeHash: "h", ExpiresAt: time.Now().Add(-time.Hour), LastSentAt: time.Now(),
+ }))
+ // Fresh row.
+ require.NoError(t, s.UpsertEmailVerificationCode(ctx, &EmailVerificationCodeMessage{
+ Email: "[email protected]", Purpose: storepb.EmailVerificationCodePurpose_LOGIN,
+ CodeHash: "h", ExpiresAt: time.Now().Add(time.Hour), LastSentAt: time.Now(),
+ }))
+
+ n, err := s.DeleteExpiredEmailVerificationCodes(ctx)
+ require.NoError(t, err)
+ assert.Equal(t, int64(1), n)
+
+ expired, _ := s.GetEmailVerificationCode(ctx, "[email protected]", storepb.EmailVerificationCodePurpose_LOGIN)
+ fresh, _ := s.GetEmailVerificationCode(ctx, "[email protected]", storepb.EmailVerificationCodePurpose_LOGIN)
+ assert.Nil(t, expired)
+ assert.NotNil(t, fresh)
+}
+```
+
+Note: `setupStoreForTest(t)` — check existing store tests (e.g. `backend/store/web_refresh_token_test.go` if it exists, or `backend/store/setting_test.go`) for the project-standard test harness. Use the same helper. If no harness exists, skip the DB-backed tests and rely on integration tests.
+
+- [ ] **Step 2: Run test to verify failure (undefined symbols)**
+
+```bash
+go test -v -count=1 github.com/bytebase/bytebase/backend/store -run TestEmailVerificationCode
+```
+
+Expected: build error / undefined.
+
+- [ ] **Step 3: Create the store file**
+
+File: `backend/store/email_verification_code.go`
+
+```go
+package store
+
+import (
+ "context"
+ "database/sql"
+ "time"
+
+ "github.com/pkg/errors"
+
+ "github.com/bytebase/bytebase/backend/common/qb"
+ storepb "github.com/bytebase/bytebase/backend/generated-go/store"
+)
+
+type EmailVerificationCodeMessage struct {
+ Email string
+ Purpose storepb.EmailVerificationCodePurpose
+ CodeHash string
+ Attempts int
+ ExpiresAt time.Time
+ LastSentAt time.Time
+}
+
+// UpsertEmailVerificationCodeIfCooldownExpired inserts or updates the row for (email, purpose),
+// but ONLY if no row exists OR the existing row's last_sent_at is older than the cooldown.
+// Returns (true, nil) if the upsert happened (caller may proceed to send the email), or
+// (false, nil) if the cooldown is still active (caller must skip the send).
+//
+// This is an atomic check-and-set: the cooldown decision and the state mutation happen in a
+// single statement. Prevents TOCTOU where two concurrent requests both pass a read-side cooldown
+// check and each send an email.
+//
+// Uses RETURNING to reliably detect whether the row was written — RowsAffected from Postgres
+// ON CONFLICT DO UPDATE ... WHERE is unreliable (returns 1 even when the WHERE filters out
+// the update). RETURNING only yields a row when the INSERT succeeded or the UPDATE's WHERE
+// matched, so a zero-row result cleanly signals "cooldown blocked the send".
+func (s *Store) UpsertEmailVerificationCodeIfCooldownExpired(ctx context.Context, msg *EmailVerificationCodeMessage, cooldown time.Duration) (bool, error) {
+ cooldownSeconds := int64(cooldown.Seconds())
+ q := qb.Q().Space(`
+ INSERT INTO email_verification_code (email, purpose, code_hash, attempts, expires_at, last_sent_at)
+ VALUES (?, ?, ?, 0, ?, ?)
+ ON CONFLICT (email, purpose) DO UPDATE SET
+ code_hash = EXCLUDED.code_hash,
+ attempts = 0,
+ expires_at = EXCLUDED.expires_at,
+ last_sent_at = EXCLUDED.last_sent_at
+ WHERE email_verification_code.last_sent_at < EXCLUDED.last_sent_at - (? || ' seconds')::interval
+ RETURNING 1
+ `, msg.Email, msg.Purpose.String(), msg.CodeHash, msg.ExpiresAt, msg.LastSentAt, cooldownSeconds)
+
+ query, args, err := q.ToSQL()
+ if err != nil {
+ return false, err
+ }
+ var dummy int
+ if err := s.GetDB().QueryRowContext(ctx, query, args...).Scan(&dummy); err != nil {
+ if errors.Is(err, sql.ErrNoRows) {
+ return false, nil // cooldown blocked the upsert
+ }
+ return false, errors.Wrap(err, "failed to upsert email verification code")
+ }
+ return true, nil
+}
+
+// GetEmailVerificationCode returns (nil, nil) if no row exists.
+func (s *Store) GetEmailVerificationCode(ctx context.Context, email string, purpose storepb.EmailVerificationCodePurpose) (*EmailVerificationCodeMessage, error) {
+ q := qb.Q().Space(`
+ SELECT email, purpose, code_hash, attempts, expires_at, last_sent_at
+ FROM email_verification_code
+ WHERE email = ? AND purpose = ?
+ `, email, purpose.String())
+
+ query, args, err := q.ToSQL()
+ if err != nil {
+ return nil, err
+ }
+
+ msg := &EmailVerificationCodeMessage{}
+ var purposeStr string
+ if err := s.GetDB().QueryRowContext(ctx, query, args...).Scan(
+ &msg.Email, &purposeStr, &msg.CodeHash, &msg.Attempts, &msg.ExpiresAt, &msg.LastSentAt,
+ ); err != nil {
+ if errors.Is(err, sql.ErrNoRows) {
+ return nil, nil
+ }
+ return nil, errors.Wrap(err, "failed to get email verification code")
+ }
+ msg.Purpose = storepb.EmailVerificationCodePurpose(storepb.EmailVerificationCodePurpose_value[purposeStr])
+ return msg, nil
+}
+
+// IncrementEmailVerificationCodeAttempts atomically +1 to the attempts column.
+func (s *Store) IncrementEmailVerificationCodeAttempts(ctx context.Context, email string, purpose storepb.EmailVerificationCodePurpose) error {
+ q := qb.Q().Space(`
+ UPDATE email_verification_code
+ SET attempts = attempts + 1
+ WHERE email = ? AND purpose = ?
+ `, email, purpose.String())
+
+ query, args, err := q.ToSQL()
+ if err != nil {
+ return err
+ }
+ if _, err := s.GetDB().ExecContext(ctx, query, args...); err != nil {
+ return errors.Wrap(err, "failed to increment email verification code attempts")
+ }
+ return nil
+}
+
+// DeleteEmailVerificationCode removes the row for (email, purpose).
+func (s *Store) DeleteEmailVerificationCode(ctx context.Context, email string, purpose storepb.EmailVerificationCodePurpose) error {
+ q := qb.Q().Space(`
+ DELETE FROM email_verification_code
+ WHERE email = ? AND purpose = ?
+ `, email, purpose.String())
+
+ query, args, err := q.ToSQL()
+ if err != nil {
+ return err
+ }
+ if _, err := s.GetDB().ExecContext(ctx, query, args...); err != nil {
+ return errors.Wrap(err, "failed to delete email verification code")
+ }
+ return nil
+}
+
+// DeleteExpiredEmailVerificationCodes deletes all rows where expires_at < NOW().
+// Returns the number of rows deleted.
+func (s *Store) DeleteExpiredEmailVerificationCodes(ctx context.Context) (int64, error) {
+ q := qb.Q().Space(`
+ DELETE FROM email_verification_code
+ WHERE expires_at < NOW()
+ `)
+
+ query, args, err := q.ToSQL()
+ if err != nil {
+ return 0, err
+ }
+ result, err := s.GetDB().ExecContext(ctx, query, args...)
+ if err != nil {
+ return 0, errors.Wrap(err, "failed to delete expired email verification codes")
+ }
+ return result.RowsAffected()
+}
+```
+
+- [ ] **Step 4: Build**
+
+```bash
+go build ./backend/store/...
+```
+
+Expected: clean build.
+
+- [ ] **Step 5: Run store tests**
+
+```bash
+go test -v -count=1 github.com/bytebase/bytebase/backend/store -run TestEmailVerificationCode
+```
+
+Expected: all tests PASS. If the test harness `setupStoreForTest` doesn't exist, skip the test file and let integration tests (Task 14) cover this.
+
+---
+
+### Task 7: Remove legacy password-reset JWT code
+
+**Files:**
+- Modify: `backend/api/auth/tokens.go`
+- Modify: `backend/api/auth/auth.go` (if it references the removed functions — unlikely, but check)
+
+- [ ] **Step 1: Delete functions from `tokens.go`**
+
+Remove these items:
+
+1. The constant `PasswordResetTokenAudience` (around line 42).
+2. The constant `passwordResetTokenDuration` (15-min duration).
+3. Function `GeneratePasswordResetToken(userEmail, secret string) (string, error)` (lines ~59-63).
+4. Function `GetEmailFromPasswordResetToken(token, secret string) (string, error)` (lines ~65-84).
+
+- [ ] **Step 2: Build to surface any remaining references**
+
+```bash
+go build ./backend/... 2>&1 | head
+```
+
+Expected: errors pointing to `auth_service.go` (we'll fix those in Task 9/10). Other errors mean something else uses these — update accordingly.
+
+---
+
+### Task 8: Extract workspace-provisioning helper from Signup
+
+**Files:**
+- Modify: `backend/api/v1/auth_service.go`
+
+- [ ] **Step 1: Locate the Signup workspace-provisioning block**
+
+Open `auth_service.go`, find the `Signup` method (starts around line 182). Inside it, locate the block that:
+1. Looks up existing workspaces for the email (via `ListWorkspacesByEmail`).
+2. If none: creates a new workspace with `getAdditionalWorkspaceSettings()`.
+3. If some: joins the first one.
+4. Ends with the new user's workspace ID known.
+
+- [ ] **Step 2: Extract to a helper**
+
+Define a new method on `*AuthService`:
+
+```go
+// provisionWorkspaceForNewUser returns a workspace ID for the freshly-created user.
+// If the email was pre-invited to existing workspaces (via IAM), returns the first one.
+// Otherwise creates a new workspace (SaaS: per-user; self-hosted: joins the singleton).
+// Called by both the Signup RPC and the email-code signup branch of Login.
+func (s *AuthService) provisionWorkspaceForNewUser(ctx context.Context, email string) (string, error) {
+ // MOVE the existing Signup block's body here.
+ // Return the resolved workspace ID.
+}
+```
+
+Replace the original code inside `Signup` with a call to this helper. Preserve exact semantics — this is a refactor, no behavior change.
+
+- [ ] **Step 3: Build + ensure no regressions**
+
+```bash
+go build ./backend/... && go test -count=1 github.com/bytebase/bytebase/backend/api/v1
+```
+
+Expected: clean build; existing auth tests pass.
+
+---
+
+### Task 9: SendEmailLoginCode RPC + shared email-sending helper
+
+**Files:**
+- Modify: `backend/api/v1/auth_service.go`
+
+- [ ] **Step 1: Add constants**
+
+Near the top of `auth_service.go` (where other auth constants live):
+
+```go
+const (
+ emailCodeLength = 6
+ emailCodeExpiry = 10 * time.Minute
+ emailCodeMaxAttempts = 5
+ emailCodeResendCooldown = 60 * time.Second
+)
+```
+
+The 60-sec cooldown caps sends at ~60/hour/email, which is the only rate limit. See the "Rate-limiting design note" in Step 3.
+
+- [ ] **Step 2: Add the code-generation helper**
+
+Inside `auth_service.go`:
+
+```go
+// generateEmailCode returns a cryptographically-random 6-digit numeric code as a string.
+func generateEmailCode() (string, error) {
+ const digits = "0123456789"
+ bytes := make([]byte, emailCodeLength)
+ if _, err := rand.Read(bytes); err != nil {
+ return "", err
+ }
+ for i := range bytes {
+ bytes[i] = digits[int(bytes[i])%len(digits)]
+ }
+ return string(bytes), nil
+}
+
+// hashEmailCode returns HMAC-SHA256(code) hex-encoded, keyed with the server's auth secret.
+// HMAC with a server-side secret (vs. bare SHA-256) prevents offline brute force of the
+// 10^6-size code space if the DB is ever compromised — the attacker would also need the
+// auth secret to verify candidate codes.
+func (s *AuthService) hashEmailCode(code string) string {
+ mac := hmac.New(sha256.New, []byte(s.secret))
+ mac.Write([]byte(code))
+ return hex.EncodeToString(mac.Sum(nil))
+}
+```
+
+Ensure imports include `crypto/hmac`, `crypto/rand`, `crypto/sha256`, `encoding/hex`.
+
+**Note:** `hashEmailCode` is a method on `*AuthService` (needs `s.secret`). All call sites in this plan use `s.hashEmailCode(code)` — update references below if you see a package-level call.
+
+- [ ] **Step 3: Add SendEmailLoginCode RPC**
+
+```go
+// SendEmailLoginCode sends a 6-digit verification code. Always returns success
+// (no email enumeration). Rate limit: 60-sec resend cooldown enforced via DB
+// last_sent_at inside sendEmailVerificationCode → effective cap ≈ 60 sends/hour/email.
+func (s *AuthService) SendEmailLoginCode(ctx context.Context, req *connect.Request[v1pb.SendEmailLoginCodeRequest]) (*connect.Response[emptypb.Empty], error) {
+ email := strings.ToLower(strings.TrimSpace(req.Msg.Email))
+ if email == "" {
+ return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("email is required"))
+ }
+
+ // Fire-and-forget: cooldown check + send. Always return success to caller.
+ go s.sendEmailVerificationCode(
+ context.WithoutCancel(ctx),
+ email,
+ storepb.EmailVerificationCodePurpose_LOGIN,
+ "[Bytebase] Your sign-in code",
+ "Hi,\n\nYour sign-in code is: %s\n\nThis code expires in 10 minutes. If you didn't request this, you can safely ignore this email.\n\n— Bytebase",
+ )
+
+ return connect.NewResponse(&emptypb.Empty{}), nil
+}
+```
+
+**Rate-limiting design note:** The spec initially proposed a separate 10/hour cap via audit-log counting, but `SendEmailLoginCode` is unauthenticated and has no workspace context — the audit middleware skips writing logs in that case (`backend/api/v1/audit.go:217-224`), so the count query would always return 0 and the cap would be ineffective. The 60-second `last_sent_at` cooldown inside `sendEmailVerificationCode` (enforced on the `(email, purpose)` row) already provides rate limiting: maximum ~60 sends per hour per email. This is strict enough without adding complexity. Remove `emailCodeSendMaxPerHour` from the constants block in Step 1.
+
+- [ ] **Step 4: Add the shared `sendEmailVerificationCode` helper**
+
+```go
+// sendEmailVerificationCode generates a code, stores its hash, and emails the plain code.
+// Errors are logged, never returned (avoids email enumeration).
+// `bodyFmt` must contain one %s for the 6-digit code.
+func (s *AuthService) sendEmailVerificationCode(ctx context.Context, email string, purpose storepb.EmailVerificationCodePurpose, subject, bodyFmt string) {
+ // For password reset, only send to existing principals — no upsert, no email for unknown addresses.
+ // Prevents arbitrary email spam and matches the legacy sendPasswordResetEmail behavior.
+ // LOGIN purpose intentionally skips this check because it also covers signup.
+ if purpose == storepb.EmailVerificationCodePurpose_PASSWORD_RESET {
+ account, err := s.store.GetAccountByEmail(ctx, email)
+ if err != nil {
+ slog.Warn("failed to look up account for password reset", log.BBError(err))
+ return
+ }
+ if account == nil || account.Type != storepb.PrincipalType_END_USER {
+ return // silent: account doesn't exist
+ }
+ }
+
+ // Generate code + hash. We must generate BEFORE the atomic upsert so we have the code_hash
+ // to store. If the upsert is blocked by cooldown, we simply discard the generated code.
+ code, err := generateEmailCode()
+ if err != nil {
+ slog.Warn("failed to generate email code", log.BBError(err))
+ return
+ }
+ now := time.Now()
+
+ // Atomic check-and-set: upsert ONLY if cooldown has expired. Prevents TOCTOU where two
+ // concurrent requests both see an expired cooldown and both send emails.
+ proceeded, err := s.store.UpsertEmailVerificationCodeIfCooldownExpired(ctx, &store.EmailVerificationCodeMessage{
+ Email: email,
+ Purpose: purpose,
+ CodeHash: s.hashEmailCode(code),
+ ExpiresAt: now.Add(emailCodeExpiry),
+ LastSentAt: now,
+ }, emailCodeResendCooldown)
+ if err != nil {
+ slog.Warn("failed to upsert email verification code", log.BBError(err))
+ return
+ }
+ if !proceeded {
+ return // silent: cooldown not expired
+ }
+
+ // Resolve EMAIL setting across candidate workspaces. For multi-workspace users, the first
+ // workspace returned by ListWorkspacesByEmail may not have EMAIL configured while another does.
+ // Scan until we find a usable setting. Fall back to env-var EMAIL_CONFIG if none match.
+ var emailSetting *storepb.EmailSetting
+ workspaces, _ := s.store.ListWorkspacesByEmail(ctx, &store.FindWorkspaceMessage{Email: email, IncludeAllUser: true})
+ for _, ws := range workspaces {
+ emailSettingMsg, err := s.store.GetSetting(ctx, ws.ResourceID, storepb.SettingName_EMAIL)
+ if err != nil || emailSettingMsg == nil {
+ continue
+ }
+ es, ok := emailSettingMsg.Value.(*storepb.EmailSetting)
+ if !ok || es == nil {
+ continue
+ }
+ emailSetting = es
+ break
+ }
+ if emailSetting == nil {
+ // Fallback to EMAIL_CONFIG env var for brand-new signups (workspace doesn't exist yet).
+ if raw := os.Getenv("EMAIL_CONFIG"); raw != "" {
+ emailSetting = &storepb.EmailSetting{}
+ if err := common.ProtojsonUnmarshaler.Unmarshal([]byte(raw), emailSetting); err != nil {
+ slog.Warn("failed to parse EMAIL_CONFIG", log.BBError(err))
+ return
+ }
+ }
+ }
+ if emailSetting == nil {
+ slog.Warn("no email setting configured; cannot send verification code", slog.String("email", email))
+ return
+ }
+
+ sender, err := mailer.NewSender(emailSetting)
+ if err != nil {
+ slog.Warn("failed to create mail sender", log.BBError(err))
+ return
+ }
+
+ body := fmt.Sprintf(bodyFmt, code)
+ if err := sender.Send(ctx, &mailer.SendRequest{
+ To: []string{email},
+ Subject: subject,
+ TextBody: body,
+ }); err != nil {
+ slog.Warn("failed to send email verification code", slog.String("to", email), log.BBError(err))
+ }
+}
+```
+
+- [ ] **Step 5: Build**
+
+```bash
+go build ./backend/... 2>&1 | tail
+```
+
+Expected: clean (existing password-reset code may still reference things — we fix that in Task 11).
+
+---
+
+### Task 10: Login email_code branch + verifyEmailCode helper
+
+**Files:**
+- Modify: `backend/api/v1/auth_service.go`
+
+- [ ] **Step 1: Add the verifyEmailCode helper**
+
+```go
+// verifyEmailCode checks a submitted code against the stored row.
+// Enforces expiry, attempt limit, and constant-time hash compare.
+// On successful match, deletes the row (one-time use). Caller continues from there.
+func (s *AuthService) verifyEmailCode(ctx context.Context, email string, purpose storepb.EmailVerificationCodePurpose, submittedCode string) error {
+ row, err := s.store.GetEmailVerificationCode(ctx, email, purpose)
+ if err != nil {
+ return connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to get email verification code"))
+ }
+ if row == nil {
+ return connect.NewError(connect.CodeUnauthenticated, errors.Errorf("invalid or expired code"))
+ }
+ if time.Now().After(row.ExpiresAt) {
+ _ = s.store.DeleteEmailVerificationCode(ctx, email, purpose)
+ return connect.NewError(connect.CodeUnauthenticated, errors.Errorf("invalid or expired code"))
+ }
+ if row.Attempts >= emailCodeMaxAttempts {
+ _ = s.store.DeleteEmailVerificationCode(ctx, email, purpose)
+ return connect.NewError(connect.CodeUnauthenticated, errors.Errorf("too many attempts"))
+ }
+ if subtle.ConstantTimeCompare([]byte(s.hashEmailCode(submittedCode)), []byte(row.CodeHash)) != 1 {
+ _ = s.store.IncrementEmailVerificationCodeAttempts(ctx, email, purpose)
+ return connect.NewError(connect.CodeUnauthenticated, errors.Errorf("invalid or expired code"))
+ }
+ _ = s.store.DeleteEmailVerificationCode(ctx, email, purpose)
+ return nil
+}
+```
+
+Ensure imports include `crypto/subtle`.
+
+- [ ] **Step 2: Add the email-code branch to authenticateLogin**
+
+Find `authenticateLogin` (around line 864). Modify to insert the email-code branch:
+
+```go
+func (s *AuthService) authenticateLogin(ctx context.Context, request *v1pb.LoginRequest) (*store.UserMessage, error) {
+ mfaSecondLogin := request.GetMfaTempToken() != ""
+
+ if mfaSecondLogin {
+ return s.completeMFALogin(ctx, request)
+ }
+
+ if request.GetIdpName() != "" {
+ return s.getOrCreateUserWithIDP(ctx, request)
+ }
+
+ if request.EmailCode != nil && *request.EmailCode != "" {
+ return s.authenticateEmailCodeLogin(ctx, request)
+ }
+
+ return s.getAndVerifyUser(ctx, request)
+}
+```
+
+- [ ] **Step 3: Implement authenticateEmailCodeLogin**
+
+```go
+// authenticateEmailCodeLogin handles the email + 6-digit code flow.
+// Existing users: verify code → return user. Unknown emails: verify code → provision new user + workspace.
+func (s *AuthService) authenticateEmailCodeLogin(ctx context.Context, request *v1pb.LoginRequest) (*store.UserMessage, error) {
+ if request.Password != "" || request.GetIdpName() != "" {
+ return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("email_code is mutually exclusive with password and idp_name"))
+ }
+ email := strings.ToLower(strings.TrimSpace(request.Email))
+ if email == "" {
+ return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("email is required"))
+ }
+
+ if err := s.verifyEmailCode(ctx, email, storepb.EmailVerificationCodePurpose_LOGIN, *request.EmailCode); err != nil {
+ return nil, err
+ }
+
+ // Existing user → return. allow_email_code_signin is checked later in validateLoginPermissions
+ // against the actually-resolved login workspace (which may not be preInvitedWorkspaces[0] for
+ // multi-workspace users — resolveWorkspaceForLogin prefers LastLoginWorkspace).
+ user, err := s.store.GetUserByEmail(ctx, email)
+ if err != nil {
+ return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to find user"))
+ }
+ if user != nil {
+ return user, nil
+ }
+
+ // Unknown email → signup path.
+ // For signup, the gate MUST run BEFORE user creation to avoid orphan accounts.
+ // The workspace the new user will join is determined by ListWorkspacesByEmail (pre-invited
+ // workspaces) or provisioned fresh. Check pre-invited workspace policies now; fresh workspaces
+ // inherit allow_email_code_signin=true via getAdditionalWorkspaceSettings so they don't need
+ // a pre-check. Fail closed on store errors: transient failures must not bypass signup policy.
+ preInvitedWorkspaces, err := s.store.ListWorkspacesByEmail(ctx, &store.FindWorkspaceMessage{Email: email, IncludeAllUser: true})
+ if err != nil {
+ return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to list workspaces for email"))
+ }
+ if len(preInvitedWorkspaces) > 0 {
+ profile, err := s.store.GetWorkspaceProfileSetting(ctx, preInvitedWorkspaces[0].ResourceID)
+ if err != nil {
+ return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to load workspace profile"))
+ }
+ if profile != nil {
+ if !profile.AllowEmailCodeSignin {
+ return nil, connect.NewError(connect.CodeFailedPrecondition, errors.Errorf("email code login is not enabled for this workspace"))
+ }
+ if profile.DisallowSignup {
+ return nil, connect.NewError(connect.CodeUnauthenticated, errors.Errorf("account not found"))
+ }
+ }
+ }
+
+ // Create principal with random bcrypt password.
+ randomBytes := make([]byte, 32)
+ if _, err := rand.Read(randomBytes); err != nil {
+ return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to generate random password"))
+ }
+ passwordHash, err := bcrypt.GenerateFromPassword(randomBytes, bcrypt.DefaultCost)
+ if err != nil {
+ return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to hash password"))
+ }
+
+ // Derive display name from email local-part.
+ name := email
+ if i := strings.Index(email, "@"); i > 0 {
+ name = email[:i]
+ }
+
+ newUser, err := s.store.CreateUser(ctx, &store.UserMessage{
+ Email: email,
+ Name: name,
+ Type: storepb.PrincipalType_END_USER,
+ PasswordHash: string(passwordHash),
+ })
+ if err != nil {
+ return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to create user"))
+ }
+
+ // Provision workspace for the new user (joins pre-invited workspace or creates a new one).
+ // Brand-new workspaces inherit allow_email_code_signin from getAdditionalWorkspaceSettings
+ // (enabled by default in SaaS when EMAIL_CONFIG is set), so no separate check is needed.
+ if _, err := s.provisionWorkspaceForNewUser(ctx, email); err != nil {
+ return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to provision workspace"))
+ }
+
+ return newUser, nil
+}
+```
+
+Note: double-check the exact `store.CreateUser` signature and `UserMessage` shape while implementing — match the Signup RPC's usage exactly.
+
+- [ ] **Step 4: Update `validateLoginPermissions` (backend/api/v1/auth_service.go:910-951)**
+
+Two changes, both necessary for SaaS to work:
+
+**(a)** Exempt email-code logins from the `DisallowPasswordSignin` gate. Without this, SaaS defaults (`DisallowPasswordSignin=true`) block every email-code login.
+
+**(b)** Add a post-resolution check on `allow_email_code_signin` using the actually-resolved `workspaceID`. For multi-workspace users, `resolveWorkspaceForLogin` prefers `LastLoginWorkspace`, which may differ from `preInvitedWorkspaces[0]`. The signup-time check in Task 10 Step 3 only covers the first-time case; this covers all subsequent logins.
+
+Open `validateLoginPermissions` and replace the existing `DisallowPasswordSignin` block (lines ~932-947) with:
+
+```go
+// Skip restrictions for MFA second login (already validated in first step)
+mfaSecondLogin := request.GetMfaTempToken() != ""
+if mfaSecondLogin {
+ return nil
+}
+
+isEmailCodeLogin := request.EmailCode != nil && *request.EmailCode != ""
+
+// Check disallow password signin when not through IDP or email-code.
+// Email-code is a separate auth method; DisallowPasswordSignin must not apply.
+if request.GetIdpName() == "" && !isEmailCodeLogin {
+ restriction, err := getAccountRestriction(
+ ctx,
+ s.store,
+ s.licenseService,
+ s.profile.SaaS,
+ workspaceID,
+ )
+ if err != nil {
+ return err
+ }
+ if restriction.DisallowPasswordSignin {
+ return connect.NewError(connect.CodePermissionDenied, errors.Errorf("password signin is disallowed"))
+ }
+}
+
+// For email-code logins, verify that the resolved workspace has it enabled.
+if isEmailCodeLogin {
+ profile, err := s.store.GetWorkspaceProfileSetting(ctx, workspaceID)
+ if err != nil {
+ return connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to load workspace profile"))
+ }
+ if profile == nil || !profile.AllowEmailCodeSignin {
+ return connect.NewError(connect.CodeFailedPrecondition, errors.Errorf("email code login is not enabled for this workspace"))
+ }
+}
+```
+
+- [ ] **Step 5: Build + lint**
+
+```bash
+go build ./backend/api/v1/... && golangci-lint run --allow-parallel-runners ./backend/api/v1/...
+```
+
+Expected: clean build, 0 lint issues.
+
+---
+
+### Task 11: Rewrite RequestPasswordReset + ResetPassword (code-based)
+
+**Files:**
+- Modify: `backend/api/v1/auth_service.go`
+
+- [ ] **Step 1: Replace RequestPasswordReset body**
+
+Replace the existing `RequestPasswordReset` (lines ~1396-1406) with:
+
+```go
+// RequestPasswordReset sends a password reset email. Always returns success to avoid leaking email existence.
+func (s *AuthService) RequestPasswordReset(ctx context.Context, req *connect.Request[v1pb.RequestPasswordResetRequest]) (*connect.Response[emptypb.Empty], error) {
+ email := strings.ToLower(strings.TrimSpace(req.Msg.Email))
+ if email == "" {
+ return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("email is required"))
+ }
+
+ // Reject if the account doesn't exist — but return success silently (no email enumeration).
+ // The cooldown + verification check is handled inside sendEmailVerificationCode.
+ go s.sendEmailVerificationCode(
+ context.WithoutCancel(ctx),
+ email,
+ storepb.EmailVerificationCodePurpose_PASSWORD_RESET,
+ "[Bytebase] Reset your password",
+ "Hi,\n\nYour password reset code is: %s\n\nThis code expires in 10 minutes. If you didn't request this, you can safely ignore this email.\n\n— Bytebase",
+ )
+
+ return connect.NewResponse(&emptypb.Empty{}), nil
+}
+```
+
+- [ ] **Step 2: Replace ResetPassword body**
+
+Replace the existing `ResetPassword` (lines ~1409-1449) with:
+
+```go
+// ResetPassword verifies the 6-digit code and updates the user's password.
+// Also revokes all refresh tokens to force re-login.
+func (s *AuthService) ResetPassword(ctx context.Context, req *connect.Request[v1pb.ResetPasswordRequest]) (*connect.Response[emptypb.Empty], error) {
+ email := strings.ToLower(strings.TrimSpace(req.Msg.Email))
+ if email == "" {
+ return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("email is required"))
+ }
+ if req.Msg.Code == "" {
+ return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("code is required"))
+ }
+ if req.Msg.NewPassword == "" {
+ return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("new_password is required"))
+ }
+
+ if err := s.verifyEmailCode(ctx, email, storepb.EmailVerificationCodePurpose_PASSWORD_RESET, req.Msg.Code); err != nil {
+ return nil, err
+ }
+
+ user, err := s.store.GetUserByEmail(ctx, email)
+ if err != nil {
+ return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to find user"))
+ }
+ if user == nil {
+ // Should be rare — row existed when code was sent. Generic error.
+ return nil, connect.NewError(connect.CodeNotFound, errors.Errorf("user not found"))
+ }
+
+ passwordHash, err := bcrypt.GenerateFromPassword([]byte(req.Msg.NewPassword), bcrypt.DefaultCost)
+ if err != nil {
+ return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to hash password"))
+ }
+ passwordHashStr := string(passwordHash)
+ if _, err := s.store.UpdateUser(ctx, user, &store.UpdateUserMessage{
+ Email: &user.Email,
+ PasswordHash: &passwordHashStr,
+ }); err != nil {
+ return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to update password"))
+ }
+
+ if err := s.store.DeleteWebRefreshTokensByUser(ctx, user.Email); err != nil {
+ slog.Warn("failed to revoke refresh tokens after password reset", log.BBError(err))
+ }
+
+ return connect.NewResponse(&emptypb.Empty{}), nil
+}
+```
+
+- [ ] **Step 3: Delete the now-unused `sendPasswordResetEmail` function**
+
+The old `sendPasswordResetEmail` (lines ~1451-1500) is no longer used. Delete it in its entirety.
+
+- [ ] **Step 4: Build**
+
+```bash
+go build ./backend/... 2>&1 | tail
+```
+
+Expected: clean build. If `fmt` or `utils` imports become unused after deletion, remove them.
+
+---
+
+### Task 12: Restriction — expose allow_email_code_signin to actuator
+
+**Files:**
+- Modify: `backend/api/v1/auth_service.go:1346-1393` (`getAccountRestriction`)
+
+- [ ] **Step 1: Add the field population**
+
+Inside `getAccountRestriction`, find where `DisallowPasswordSignin` is set (twice — default struct init and the workspace-specific block). Mirror `AllowEmailCodeSignin`:
+
+In the default restriction block:
+```go
+restriction := &v1pb.Restriction{
+ DisallowSignup: false,
+ DisallowPasswordSignin: false,
+ PasswordRestriction: defaultPasswordRestriction,
+ AllowEmailCodeSignin: false,
+}
+```
+
+In the workspace-specific block (where `setting` is loaded):
+```go
+restriction = &v1pb.Restriction{
+ PasswordRestriction: convertToV1PasswordRestriction(setting.GetPasswordRestriction()),
+ DisallowSignup: setting.DisallowSignup,
+ DisallowPasswordSignin: setting.DisallowPasswordSignin,
+ AllowEmailCodeSignin: setting.AllowEmailCodeSignin,
+}
+```
+
+No license-gate for `AllowEmailCodeSignin` — the feature requires EMAIL setting, which is already the effective gate.
+
+- [ ] **Step 2: Build**
+
+```bash
+go build ./backend/api/v1/...
+```
+
+Expected: clean.
+
+---
+
+### Task 13: Setting service — validate allow_email_code_signin + SaaS read-only
+
+**Files:**
+- Modify: `backend/api/v1/setting_service.go` (around lines 289-308, the existing `disallow_password_signin` validation)
+
+- [ ] **Step 1: Locate the WORKSPACE_PROFILE update_mask switch**
+
+Open `setting_service.go`. Find the `UpdateSetting` function's WORKSPACE_PROFILE case. Inside it, there's a switch on `update_mask` paths, including `value.workspace_profile.disallow_password_signin` (around line 289).
+
+- [ ] **Step 2: Add a new case for allow_email_code_signin**
+
+Next to the `disallow_password_signin` case, add:
+
+```go
+case "value.workspace_profile.allow_email_code_signin":
+ if s.profile.SaaS {
+ return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("allow_email_code_signin cannot be changed in SaaS mode"))
+ }
+ if payload.AllowEmailCodeSignin {
+ emailSetting, err := s.store.GetSetting(ctx, workspaceID, storepb.SettingName_EMAIL)
+ if err != nil {
+ return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to load email setting"))
+ }
+ if emailSetting == nil {
+ return nil, connect.NewError(connect.CodeFailedPrecondition, errors.Errorf("cannot enable email code signin without an EMAIL setting"))
+ }
+ }
+ oldSetting.AllowEmailCodeSignin = payload.AllowEmailCodeSignin
+```
+
+The field naming (`oldSetting`, `payload`, etc.) depends on the surrounding code — mirror the pattern used by the `disallow_password_signin` case exactly.
+
+- [ ] **Step 3: Build + lint**
+
+```bash
+go build ./backend/api/v1/... && golangci-lint run --allow-parallel-runners ./backend/api/v1/...
+```
+
+Expected: clean.
+
+---
+
+### Task 14: Inject allow_email_code_signin on SaaS workspace creation
+
+**Files:**
+- Modify: `backend/api/v1/auth_service.go` — `getAdditionalWorkspaceSettings` (or wherever the SaaS Signup workspace defaults are set)
+
+- [ ] **Step 1: Find where WorkspaceProfileSetting defaults are assembled in SaaS**
+
+The Signup RPC (or `getAdditionalWorkspaceSettings`) constructs the initial WORKSPACE_PROFILE setting for a new SaaS workspace. It already sets `DisallowPasswordSignin = true`. Find that block.
+
+- [ ] **Step 2: Add allow_email_code_signin injection**
+
+Inside the same block (SaaS + `EMAIL_CONFIG` env var present), set:
+
+```go
+if saas && os.Getenv("EMAIL_CONFIG") != "" {
+ workspaceProfile.AllowEmailCodeSignin = true
+}
+```
+
+If the construction happens by way of an `AdditionalSetting` (like the EMAIL setting itself), add a similar entry for WORKSPACE_PROFILE — or modify the existing WORKSPACE_PROFILE injection to include this field.
+
+- [ ] **Step 3: Build**
+
+```bash
+go build ./backend/api/v1/...
+```
+
+Expected: clean.
+
+---
+
+### Task 15: Background cleanup sweeper
+
+**Files:**
+- Modify: `backend/runner/cleaner/data_cleaner.go` (around line 78-83 for main loop, and wherever `cleanupWebRefreshTokens` is defined)
+
+- [ ] **Step 1: Add cleanup method**
+
+Near `cleanupWebRefreshTokens`, add:
+
+```go
+func (c *DataCleaner) cleanupEmailVerificationCodes(ctx context.Context) {
+ n, err := c.store.DeleteExpiredEmailVerificationCodes(ctx)
+ if err != nil {
+ slog.Error("Failed to clean up expired email verification codes", log.BBError(err))
+ return
+ }
+ if n > 0 {
+ slog.Info("Cleaned up expired email verification codes", slog.Int64("count", n))
+ }
+}
+```
+
+- [ ] **Step 2: Wire into the sweeper loop**
+
+Find the loop that calls `c.cleanupWebRefreshTokens(ctx)`. Immediately after that call, add:
+
+```go
+c.cleanupEmailVerificationCodes(ctx)
+```
+
+- [ ] **Step 3: Build**
+
+```bash
+go build ./backend/runner/...
+```
+
+Expected: clean.
+
+---
+
+### Task 16: Integration tests for auth flow
+
+**Files:**
+- Create or modify: `backend/tests/auth_test.go` (project-standard integration test location)
+
+- [ ] **Step 1: Add test cases**
+
+Find the existing auth integration test file (check `backend/tests/` for test files that exercise the `Login` RPC). Add these cases, mirroring the style of existing tests:
+
+```go
+func TestEmailCodeLogin_HappyPath(t *testing.T) {
+ // Setup: create workspace with EMAIL setting + allow_email_code_signin=true.
+ // 1. Call SendEmailLoginCode(email).
+ // 2. Extract the generated code from the test mail sink (intercept mailer.Send).
+ // 3. Call Login(email, email_code=code).
+ // 4. Assert token returned + user exists (or was created).
+}
+
+func TestEmailCodeLogin_ResendWithinCooldown(t *testing.T) {
+ // 1. SendEmailLoginCode.
+ // 2. Immediately SendEmailLoginCode again.
+ // 3. Assert second call does not reset last_sent_at (query DB directly).
+}
+
+func TestEmailCodeLogin_WrongCodeLocksOut(t *testing.T) {
+ // 1. SendEmailLoginCode.
+ // 2. Call Login(email_code=wrong) 5 times → each returns Unauthenticated "invalid or expired code".
+ // 3. 6th Login(email_code=wrong) returns "too many attempts".
+ // 4. DB row deleted.
+}
+
+func TestEmailCodeLogin_DisallowSignup(t *testing.T) {
+ // Setup: workspace with disallow_signup=true.
+ // Call Login(new-email, email_code=valid).
+ // Assert Unauthenticated "account not found".
+}
+
+func TestEmailCodeLogin_WorkspaceDisallows(t *testing.T) {
+ // Setup: existing user in workspace with allow_email_code_signin=false.
+ // 1. SendEmailLoginCode → returns success (cooldown/send always succeeds).
+ // 2. Login(valid code) → FailedPrecondition "email code login is not enabled".
+}
+
+func TestEmailCodeLogin_2FAInteraction(t *testing.T) {
+ // Setup: existing user with TOTP enabled.
+ // Login(email_code=valid) → response has mfa_temp_token, requires MFA completion.
+}
+
+func TestPasswordReset_CodeFlow(t *testing.T) {
+ // 1. RequestPasswordReset(email).
+ // 2. Extract code from mail sink.
+ // 3. ResetPassword(email, code, new_password) → success.
+ // 4. Login(email, password=new_password) → success.
+ // 5. Old refresh tokens invalidated.
+}
+```
+
+- [ ] **Step 2: Provide the mail-sink test helper**
+
+If a mail-capture helper doesn't exist, either:
+- Use a `mailer.Sender` interface stub injected into the test harness.
+- Or read the code directly from the DB (`GetEmailVerificationCode`) and hash-compare — acceptable shortcut since the tests verify end-to-end behavior.
+
+Prefer the DB approach for simplicity (no sender mock needed).
+
+- [ ] **Step 3: Run**
+
+```bash
+go test -v -count=1 github.com/bytebase/bytebase/backend/tests -run TestEmailCodeLogin
+```
+
+Expected: all PASS.
+
+---
+
+### Task 17: Frontend store — sendEmailLoginCode + login with emailCode
+
+**Files:**
+- Modify: `frontend/src/store/modules/v1/auth.ts`
+
+- [ ] **Step 1: Add sendEmailLoginCode action**
+
+Inside the auth store's `defineStore` body, add:
+
+```ts
+const sendEmailLoginCode = async (email: string) => {
+ await authServiceClientConnect.sendEmailLoginCode(
+ create(SendEmailLoginCodeRequestSchema, { email })
+ );
+};
+```
+
+Import `SendEmailLoginCodeRequestSchema` from `@/types/proto-es/v1/auth_service_pb`.
+
+- [ ] **Step 2: Expose sendEmailLoginCode in the return statement**
+
+Find the `return { ... }` at the end of `defineStore`. Add `sendEmailLoginCode` to the exported object.
+
+- [ ] **Step 3: Verify `login()` threads emailCode through**
+
+The existing `login()` calls `authServiceClientConnect.login(request)`. The generated `LoginRequest` now has `emailCode` after proto regen. No code changes needed — callers pass `emailCode` via the `request` object.
+
+- [ ] **Step 4: Type-check**
+
+```bash
+pnpm --dir frontend type-check
+```
+
+Expected: clean.
+
+---
+
+### Task 18: Frontend — Signin.vue email-code tab
+
+**Files:**
+- Create: `frontend/src/components/EmailCodeSigninForm.vue`
+- Modify: `frontend/src/views/auth/Signin.vue`
+
+- [ ] **Step 1: Create EmailCodeSigninForm component**
+
+File: `frontend/src/components/EmailCodeSigninForm.vue`
+
+```vue
+<template>
+ <form class="flex flex-col gap-y-6" @submit.prevent="handleSubmit">
+ <div v-if="step === 'email'">
+ <label for="email-code-email" class="block text-sm font-medium leading-5 text-control">
+ {{ $t("common.email") }}
+ </label>
+ <div class="mt-1 rounded-md shadow-xs">
+ <BBTextField
+ v-model:value="state.email"
+ required
+ type="email"
+ :input-props="{ id: 'email-code-email', autocomplete: 'email' }"
+ />
+ </div>
+ <NButton
+ class="mt-4 w-full"
+ type="primary"
+ size="large"
+ :disabled="!state.email || state.sending"
+ :loading="state.sending"
+ @click="sendCode"
+ >
+ {{ $t("auth.sign-in.send-code") }}
+ </NButton>
+ </div>
+
+ <div v-else class="flex flex-col gap-y-4">
+ <div class="text-sm text-control">
+ <span>{{ $t("auth.sign-in.code-sent-hint", { email: state.email }) }}</span>
+ <button type="button" class="ml-2 accent-link" @click="step = 'email'">
+ {{ $t("common.change") }}
+ </button>
+ </div>
+ <NInputOtp
+ v-model:value="state.code"
+ :length="6"
+ @finish="handleSubmit"
+ />
+ <div class="flex items-center justify-between">
+ <NButton
+ text
+ :disabled="resendCountdown > 0"
+ @click="sendCode"
+ >
+ {{ resendCountdown > 0
+ ? $t("auth.sign-in.resend-in", { seconds: resendCountdown })
+ : $t("auth.sign-in.resend-code") }}
+ </NButton>
+ <NButton
+ type="primary"
+ :disabled="state.code.length !== 6 || props.loading"
+ :loading="props.loading"
+ @click="handleSubmit"
+ >
+ {{ $t("common.verify") }}
+ </NButton>
+ </div>
+ </div>
+ </form>
+</template>
+
+<script lang="ts" setup>
+import { create } from "@bufbuild/protobuf";
+import { NButton, NInputOtp } from "naive-ui";
+import { onUnmounted, reactive, ref } from "vue";
+import { useI18n } from "vue-i18n";
+import { BBTextField } from "@/bbkit";
+import { pushNotification, useAuthStore } from "@/store";
+import { LoginRequestSchema } from "@/types/proto-es/v1/auth_service_pb";
+
+const props = defineProps<{ loading: boolean }>();
+const emit = defineEmits<{
+ (e: "signin", request: ReturnType<typeof create<typeof LoginRequestSchema>>): void;
+}>();
+
+const { t } = useI18n();
+const authStore = useAuthStore();
+const step = ref<"email" | "code">("email");
+const resendCountdown = ref(0);
+let countdownTimer: ReturnType<typeof setInterval> | null = null;
+
+const state = reactive({
+ email: "",
+ code: "",
+ sending: false,
+});
+
+const startCountdown = () => {
+ resendCountdown.value = 60;
+ if (countdownTimer) clearInterval(countdownTimer);
+ countdownTimer = setInterval(() => {
+ resendCountdown.value -= 1;
+ if (resendCountdown.value <= 0 && countdownTimer) {
+ clearInterval(countdownTimer);
+ countdownTimer = null;
+ }
+ }, 1000);
+};
+
+onUnmounted(() => {
+ if (countdownTimer) clearInterval(countdownTimer);
+});
+
+const sendCode = async () => {
+ if (!state.email || state.sending || resendCountdown.value > 0) return;
+ state.sending = true;
+ try {
+ await authStore.sendEmailLoginCode(state.email);
+ step.value = "code";
+ startCountdown();
+ } catch (error) {
+ pushNotification({
+ module: "bytebase",
+ style: "CRITICAL",
+ title: t("auth.sign-in.failed-to-send-code"),
+ });
+ } finally {
+ state.sending = false;
+ }
+};
+
+const handleSubmit = () => {
+ if (state.code.length !== 6) return;
+ emit(
+ "signin",
+ create(LoginRequestSchema, {
+ email: state.email,
+ emailCode: state.code,
+ web: true,
+ })
+ );
+};
+</script>
+```
+
+- [ ] **Step 2: Add the email-code tab to Signin.vue**
+
+Open `Signin.vue`. Find the `<NTabs>` block containing the "Standard" `NTabPane` and any IDP `NTabPane`s. After the standard tab's closing tag, add:
+
+```vue
+<NTabPane
+ v-if="serverInfo?.restriction?.allowEmailCodeSignin"
+ name="email-code"
+ :tab="$t('auth.sign-in.email-code-tab')"
+>
+ <EmailCodeSigninForm
+ :loading="state.isLoading"
+ @signin="trySignin"
+ />
+</NTabPane>
+```
+
+Add the import:
+```ts
+import EmailCodeSigninForm from "@/components/EmailCodeSigninForm.vue";
+```
+
+- [ ] **Step 3: Type-check**
+
+```bash
+pnpm --dir frontend type-check
+```
+
+Expected: clean.
+
+---
+
+### Task 19: Frontend — PasswordForgot.vue (add cooldown)
+
+**Files:**
+- Modify: `frontend/src/views/auth/PasswordForgot.vue`
+
+- [ ] **Step 1: Add 60-second client-side cooldown after successful send**
+
+In the existing `onSubmit` handler, after the successful `requestPasswordReset` call:
+
+```ts
+state.sending = true;
+state.sent = true;
+startResendCountdown();
+```
+
+Add the countdown state + timer (pattern from Task 18's EmailCodeSigninForm).
+
+- [ ] **Step 2: Update "Send reset link" button copy**
+
+Rename button label from "Send reset link" to "Send code" (i18n key update in Task 22). Body copy hint: replace "We've sent a password reset link" with "We've sent a 6-digit code to {email}".
+
+- [ ] **Step 3: Navigate to password-reset with email prefill**
+
+After successful send, instead of just showing the success message in-place, offer a button or auto-navigate to `/auth/password-reset?email={email}`.
+
+- [ ] **Step 4: Type-check**
+
+```bash
+pnpm --dir frontend type-check
+```
+
+Expected: clean.
+
+---
+
+### Task 20: Frontend — PasswordReset.vue rewrite for code-based flow
+
+**Files:**
+- Modify: `frontend/src/views/auth/PasswordReset.vue`
+
+- [ ] **Step 1: Determine "mode" from route**
+
+Keep existing "forced reset after login" mode. Detect if route has `email` query param — that signals the new code-based mode.
+
+- [ ] **Step 2: Add code-based UI branch**
+
+Replace the template with a conditional structure:
+
+```vue
+<template>
+ <div class="mx-auto w-full max-w-sm">
+ <img class="h-12 w-auto" src="@/assets/logo-full.svg" alt="Bytebase" />
+ <h2 class="mt-6 text-3xl leading-9 font-extrabold text-main">
+ {{ $t("auth.password-reset.title") }}
+ </h2>
+ <p class="textinfo mt-2">{{ $t("auth.password-reset.content") }}</p>
+
+ <div class="mt-8 flex flex-col gap-y-6">
+ <!-- Code-based mode: email + code fields -->
+ <template v-if="codeMode">
+ <div>
+ <label class="block text-sm font-medium leading-5 text-control">
+ {{ $t("common.email") }}
+ </label>
+ <BBTextField v-model:value="state.email" type="email" class="mt-1" />
+ </div>
+ <div>
+ <label class="block text-sm font-medium leading-5 text-control">
+ {{ $t("auth.password-reset.code-label") }}
+ </label>
+ <NInputOtp v-model:value="state.code" :length="6" class="mt-1" />
+ </div>
+ </template>
+
+ <!-- Both modes: new password -->
+ <UserPassword
+ ref="userPasswordRef"
+ v-model:password="state.password"
+ v-model:password-confirm="state.passwordConfirm"
+ :show-learn-more="false"
+ :password-restriction="passwordRestrictionSetting"
+ />
+
+ <NButton
+ type="primary"
+ size="large"
+ style="width: 100%"
+ :disabled="!allowConfirm"
+ @click="onConfirm"
+ >
+ {{ $t("common.confirm") }}
+ </NButton>
+ </div>
+ </div>
+</template>
+```
+
+- [ ] **Step 3: Add onConfirm logic for code-based mode**
+
+Inside the component:
+
+```ts
+const codeMode = computed(() => !!route.query.email);
+
+onMounted(() => {
+ if (codeMode.value) {
+ state.email = route.query.email as string;
+ return; // Don't require login for code-mode.
+ }
+ if (!authStore.requireResetPassword) {
+ router.replace(redirectQuery.value);
+ }
+});
+
+const allowConfirm = computed(() => {
+ if (!state.password) return false;
+ if (codeMode.value && (!state.email || state.code.length !== 6)) return false;
+ return !userPasswordRef.value?.passwordHint && !userPasswordRef.value?.passwordMismatch;
+});
+
+const onConfirm = async () => {
+ if (codeMode.value) {
+ try {
+ await authServiceClientConnect.resetPassword(
+ create(ResetPasswordRequestSchema, {
+ email: state.email,
+ code: state.code,
+ newPassword: state.password,
+ })
+ );
+ pushNotification({
+ module: "bytebase",
+ style: "SUCCESS",
+ title: t("common.updated"),
+ });
+ router.push({ name: AUTH_SIGNIN_MODULE, query: { email: state.email } });
+ } catch (error) {
+ pushNotification({
+ module: "bytebase",
+ style: "CRITICAL",
+ title: t("auth.password-reset.invalid-or-expired-code"),
+ });
+ }
+ return;
+ }
+
+ // Legacy forced-reset mode — unchanged.
+ const patch: User = { ...me.value, password: state.password };
+ await userStore.updateUser(
+ createProto(UpdateUserRequestSchema, {
+ user: patch,
+ updateMask: createProto(FieldMaskSchema, { paths: ["password"] }),
+ })
+ );
+ pushNotification({ module: "bytebase", style: "SUCCESS", title: t("common.updated") });
+ authStore.setRequireResetPassword(false);
+ router.replace(redirectQuery.value);
+};
+```
+
+Add imports for `ResetPasswordRequestSchema`, `authServiceClientConnect`, `NInputOtp`, `BBTextField`, `AUTH_SIGNIN_MODULE`.
+
+- [ ] **Step 4: Remove the old `?token=` path**
+
+The pre-existing `route.query.token` branch (if any) can be deleted — we no longer issue tokens.
+
+- [ ] **Step 5: Type-check**
+
+```bash
+pnpm --dir frontend type-check
+```
+
+Expected: clean.
+
+---
+
+### Task 21: Frontend — router query preservation
+
+**Files:**
+- Modify: `frontend/src/router/index.ts`
+
+- [ ] **Step 1: Ensure `email` is preserved in SIGNIN_QUERY_PARAMS**
+
+Grep the file for `SIGNIN_QUERY_PARAMS`. It should already include `email` (we added it earlier for invite flow). If not, add it to the array. No other router changes needed.
+
+- [ ] **Step 2: Type-check**
+
+```bash
+pnpm --dir frontend type-check
+```
+
+Expected: clean.
+
+---
+
+### Task 22: i18n keys (5 locales)
+
+**Files:**
+- Modify: `frontend/src/locales/en-US.json`
+- Modify: `frontend/src/locales/zh-CN.json`
+- Modify: `frontend/src/locales/ja-JP.json`
+- Modify: `frontend/src/locales/es-ES.json`
+- Modify: `frontend/src/locales/vi-VN.json`
+
+- [ ] **Step 1: en-US**
+
+Under `auth.sign-in`, add:
+```json
+"email-code-tab": "Email code",
+"send-code": "Send code",
+"resend-code": "Resend code",
+"resend-in": "Resend in {seconds}s",
+"code-sent-hint": "We've sent a 6-digit code to {email}",
+"failed-to-send-code": "Failed to send code"
+```
+
+Under `auth.password-reset`, add:
+```json
+"code-label": "Verification code",
+"invalid-or-expired-code": "Invalid or expired code"
+```
+
+Under `auth.password-forget`, replace existing keys if needed — ensure `send-code`, `email-sent`, `email-sent-hint` are present (may already exist from prior work; dedup if so).
+
+- [ ] **Step 2: Translate to zh-CN, ja-JP, es-ES, vi-VN**
+
+Mirror the keys. Translations:
+
+| en-US | zh-CN | ja-JP | es-ES | vi-VN |
+|-------|-------|-------|-------|-------|
+| Email code | 邮箱验证码 | メール認証コード | Código por email | Mã qua email |
+| Send code | 发送验证码 | コードを送信 | Enviar código | Gửi mã |
+| Resend code | 重新发送 | コードを再送信 | Reenviar código | Gửi lại mã |
+| Resend in {seconds}s | {seconds} 秒后可重发 | {seconds}秒後に再送信可能 | Reenviar en {seconds}s | Gửi lại sau {seconds}s |
+| We've sent a 6-digit code to {email} | 已向 {email} 发送 6 位验证码 | {email} に6桁のコードを送信しました | Hemos enviado un código de 6 dígitos a {email} | Đã gửi mã 6 chữ số đến {email} |
+| Verification code | 验证码 | 認証コード | Código de verificación | Mã xác minh |
+| Failed to send code | 发送验证码失败 | コードの送信に失敗しました | No se pudo enviar el código | Không gửi được mã |
+| Invalid or expired code | 验证码无效或已过期 | コードが無効または期限切れです | Código inválido o caducado | Mã không hợp lệ hoặc đã hết hạn |
+
+- [ ] **Step 3: Run i18n sorter + type-check**
+
+```bash
+pnpm --dir frontend fix && pnpm --dir frontend type-check
+```
+
+Expected: no changes from sorter (or it auto-sorts), type-check clean.
+
+---
+
+### Task 23: Final validation pass
+
+**Files:** None new — validation.
+
+- [ ] **Step 1: Full backend build**
+
+```bash
+go build -ldflags "-w -s" -p=16 -o ./bytebase-build/bytebase ./backend/bin/server/main.go
+```
+
+Expected: success.
+
+- [ ] **Step 2: Backend lint (full)**
+
+```bash
+golangci-lint run --allow-parallel-runners
+```
+
+Expected: 0 issues.
+
+- [ ] **Step 3: Backend tests**
+
+```bash
+go test -v -count=1 github.com/bytebase/bytebase/backend/store -run TestEmailVerificationCode
+go test -v -count=1 github.com/bytebase/bytebase/backend/tests -run TestEmailCodeLogin
+go test -v -count=1 github.com/bytebase/bytebase/backend/tests -run TestPasswordReset
+```
+
+Expected: all PASS.
+
+- [ ] **Step 4: Frontend fix + type-check**
+
+```bash
+pnpm --dir frontend fix && pnpm --dir frontend type-check
+```
+
+Expected: no errors.
+
+- [ ] **Step 5: Frontend tests**
+
+```bash
+pnpm --dir frontend test
+```
+
+Expected: all PASS.
diff --git a/docs/superpowers/specs/2026-04-14-email-code-signin-design.md b/docs/superpowers/specs/2026-04-14-email-code-signin-design.md
new file mode 100644
index 0000000000..f6f5570f9a
--- /dev/null
+++ b/docs/superpowers/specs/2026-04-14-email-code-signin-design.md
@@ -0,0 +1,421 @@
+# Email + 6-Digit Code Signin Design
+
+**Date**: 2026-04-14
+**Status**: Draft
+**Scope**: Add passwordless signin/signup using email + 6-digit verification code. Also refactor password reset to use the same code-based mechanism for consistency.
+
+---
+
+## Goal
+
+Let users sign in (and sign up) using only their email address and a one-time 6-digit code delivered via email. Mirror how Slack/Linear/Notion handle magic-code auth. Unify the password reset flow onto the same code mechanism.
+
+## Decisions (from brainstorming)
+
+| Decision | Choice | Rationale |
+|----------|--------|-----------|
+| Setting name | `allow_email_code_signin` | Clearest intent (not "2-step" since it replaces password, not augments it) |
+| Login vs alternative | Alternative to password (not replacement) | Same login page, separate tab, coexists with password & SSO |
+| Signup on unknown email | Yes, auto-create principal | Magic-code semantics; possession of inbox proves ownership |
+| New principal shape | `name` defaults to email local-part; random bcrypt password | User can later set both via profile |
+| Workspace assignment | Same as password Signup: join pre-invited workspace or create new | Symmetry with existing flow |
+| Code expiry | 10 minutes | Balances email delivery latency with security |
+| Resend cooldown | 60 seconds | Prevents mail bombing; both new login and password reset |
+| Max attempts per code | 5 | Matches existing MFA lockout threshold |
+| Per-email send rate | Effective ~60/hour via 60s cooldown | Simpler than audit-log counting, which fails for unauthenticated requests (audit middleware skips them when workspace is empty) |
+| Code storage | Dedicated DB table (`email_verification_code`) | HA-safe; stateful semantics (attempts, cooldown) can't be done with JWT |
+| Password reset | Migrate from JWT to code (shares table) | HA-correct cooldown/retry limits; unified UX |
+| 2FA interaction | TOTP still required if user has it | Defense in depth; don't silently downgrade |
+| RPC shape | Add `email_code` to existing `LoginRequest` | Reuses workspace resolution / MFA / token pipeline |
+| SaaS toggleability | Read-only like `disallow_password_signin` | Auto-enabled on workspace creation when `EMAIL_CONFIG` is set |
+
+## Non-goals
+
+- Magic-link (clickable link) login — we're doing code-only.
+- Per-workspace email template customization.
+- Rate-limiting bypass for dev/test mode.
+- Delivery receipts or bounce handling.
+- Federated SSO changes.
+
+---
+
+## 1. Proto: New Workspace Setting Field
+
+### Store proto (`proto/store/store/setting.proto`)
+
+Add to `WorkspaceProfileSetting`:
+
+```proto
+// Allow signin/signup using email + a 6-digit one-time verification code.
+// Requires the EMAIL setting to be configured on the workspace.
+bool allow_email_code_signin = NEXT;
+```
+
+### V1 proto (`proto/v1/v1/setting_service.proto`)
+
+Mirror the field in the v1 `WorkspaceProfileSetting`.
+
+### V1 proto (`proto/v1/v1/actuator_service.proto`)
+
+Add the flag to `Restriction` so the unauthenticated login page can decide whether to show the email-code tab (same plumbing as `disallow_password_signin`):
+
+```proto
+message Restriction {
+ bool disallow_signup = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
+ bool disallow_password_signin = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
+ WorkspaceProfileSetting.PasswordRestriction password_restriction = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
+ // NEW — whether email + 6-digit code signin is enabled for this workspace.
+ bool allow_email_code_signin = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
+}
+```
+
+Update `getAccountRestriction` in `auth_service.go` to populate the new field from `setting.AllowEmailCodeSignin`. License-gate it the same way as other restriction fields if a plan feature is required (TBD during implementation — likely no gate since email sending already requires the EMAIL setting).
+
+### SaaS-specific behavior
+
+- **On workspace creation**: if `EMAIL_CONFIG` env var is set, inject `allow_email_code_signin = true` via `getAdditionalWorkspaceSettings()`.
+- **`UpdateSetting` validation**: in SaaS mode, this field is read-only (return `InvalidArgument` on any attempt to change).
+- **Self-hosted**: workspace admin can toggle it. Setting `true` requires an existing EMAIL setting on the workspace; otherwise reject with `FailedPrecondition`.
+
+---
+
+## 2. Data Model
+
+### New table `email_verification_code`
+
+```sql
+CREATE TABLE email_verification_code (
+ email text NOT NULL,
+ -- Stored as EmailVerificationCodePurpose enum name (proto/store/store/email_verification_code.proto)
+ purpose text NOT NULL,
+ code_hash text NOT NULL,
+ attempts int NOT NULL DEFAULT 0,
+ expires_at timestamptz NOT NULL,
+ last_sent_at timestamptz NOT NULL,
+ PRIMARY KEY (email, purpose)
+);
+
+CREATE INDEX idx_email_verification_code_expires_at ON email_verification_code (expires_at);
+```
+
+- **PK `(email, purpose)`** — one active code per purpose per email. Resend upserts the row.
+- **No workspace column** — codes are identity-scoped (matches `principal`, `web_refresh_token`).
+- **`code_hash`** — HMAC-SHA256 of the 6-digit code, keyed with the server's `auth_secret`. Using HMAC with a server-side secret (vs. bare SHA-256) prevents offline brute force of the 10^6-size code space if the DB is ever compromised — the attacker would also need the auth secret to verify candidate codes.
+- **`expires_at` index** — backs the background cleanup job.
+
+### New proto (`proto/store/store/email_verification_code.proto`)
+
+```proto
+syntax = "proto3";
+package bytebase.store;
+option go_package = "generated-go/store";
+
+enum EmailVerificationCodePurpose {
+ EMAIL_VERIFICATION_CODE_PURPOSE_UNSPECIFIED = 0;
+ LOGIN = 1;
+ PASSWORD_RESET = 2;
+}
+```
+
+The `purpose` column stores the enum's string name (`"LOGIN"`, `"PASSWORD_RESET"`), matching `policy.resource_type` and similar patterns.
+
+### Store methods (`backend/store/email_verification_code.go`)
+
+```go
+type EmailVerificationCode struct {
+ Email string
+ Purpose storepb.EmailVerificationCodePurpose
+ CodeHash string
+ Attempts int
+ ExpiresAt time.Time
+ LastSentAt time.Time
+}
+
+// UpsertEmailVerificationCode — resets attempts to 0, overwrites code_hash, sets expires_at and last_sent_at.
+func (s *Store) UpsertEmailVerificationCode(ctx context.Context, code *EmailVerificationCode) error
+
+// GetEmailVerificationCode — returns (nil, nil) if no row exists.
+func (s *Store) GetEmailVerificationCode(ctx context.Context, email string, purpose storepb.EmailVerificationCodePurpose) (*EmailVerificationCode, error)
+
+// IncrementEmailVerificationCodeAttempts — atomic +1 to attempts.
+func (s *Store) IncrementEmailVerificationCodeAttempts(ctx context.Context, email string, purpose storepb.EmailVerificationCodePurpose) error
+
+// DeleteEmailVerificationCode — one-time invalidation on success OR when attempts exceeded.
+func (s *Store) DeleteEmailVerificationCode(ctx context.Context, email string, purpose storepb.EmailVerificationCodePurpose) error
+
+// DeleteExpiredEmailVerificationCodes — background cleanup.
+func (s *Store) DeleteExpiredEmailVerificationCodes(ctx context.Context) error
+```
+
+Add `DeleteExpiredEmailVerificationCodes` to the existing background sweeper that runs `DeleteExpiredWebRefreshTokens`.
+
+---
+
+## 3. API Surface
+
+### Modified: `LoginRequest` (`proto/v1/v1/auth_service.proto`)
+
+Add one field:
+
+```proto
+message LoginRequest {
+ // ... existing fields ...
+ // 6-digit code from email for passwordless login/signup.
+ // Pairs with `email`. Mutually exclusive with `password` and `idp_name`.
+ optional string email_code = 9;
+}
+```
+
+### New: `SendEmailLoginCode`
+
+```proto
+// Sends a 6-digit verification code to the email for login/signup.
+// Always returns success (no email enumeration). Enforces 60-sec resend cooldown.
+// Permissions required: None
+rpc SendEmailLoginCode(SendEmailLoginCodeRequest) returns (google.protobuf.Empty) {
+ option (google.api.http) = {
+ post: "/v1/auth:sendEmailLoginCode"
+ body: "*"
+ };
+ option (bytebase.v1.allow_without_credential) = true;
+ option (bytebase.v1.audit) = true;
+}
+
+message SendEmailLoginCodeRequest {
+ string email = 1;
+}
+```
+
+### Changed: `ResetPassword` — JWT token → code
+
+```proto
+message ResetPasswordRequest {
+ string email = 1;
+ string code = 2;
+ string new_password = 3;
+}
+```
+
+### Unchanged: `RequestPasswordReset`
+
+Signature unchanged, but behavior gains the 60-sec cooldown via the new DB row.
+
+---
+
+## 4. Backend Service Layer
+
+### Constants (`auth_service.go`)
+
+```go
+const (
+ emailCodeLength = 6
+ emailCodeExpiry = 10 * time.Minute
+ emailCodeMaxAttempts = 5
+ emailCodeResendCooldown = 60 * time.Second
+)
+```
+
+Remove `passwordResetTokenDuration` (was 15 min JWT). Remove `GeneratePasswordResetToken` and `GetEmailFromPasswordResetToken` from `backend/api/auth/tokens.go`.
+
+### `SendEmailLoginCode`
+
+1. Validate `req.Msg.Email` format. If invalid → `InvalidArgument`.
+2. Resend cooldown: `GetEmailVerificationCode(email, LOGIN)`. If row exists AND `now - last_sent_at < 60s` → return `Empty` silently.
+3. Generate 6-digit numeric code via `crypto/rand`. Hash with HMAC-SHA256 keyed by the server's `auth_secret` (consistent with the data-model section — bare SHA-256 would be bruteforceable across the 10^6 code space).
+4. `UpsertEmailVerificationCode` with `attempts=0`, `expires_at=now+10min`, `last_sent_at=now`.
+5. Fire-and-forget goroutine (`context.WithoutCancel`): resolve workspace → load EMAIL setting → send code via mailer. If no workspace exists yet but `EMAIL_CONFIG` env var is set, use it.
+6. Return `Empty` unconditionally.
+
+### `Login` — new `email_code` branch in `authenticateLogin`
+
+Dispatch order (in order of precedence):
+1. `mfa_temp_token` set → MFA completion (existing)
+2. `idp_name` set → IDP login (existing)
+3. `email_code` set → **new email-code branch** (below)
+4. else → password login (existing)
+
+**Email-code branch:**
+1. Reject if `password` or `idp_name` is also set → `InvalidArgument` "email_code is mutually exclusive with password and idp_name".
+2. `verifyEmailCode(ctx, email, LOGIN, submittedCode)` (shared helper — see below).
+3. Look up principal by email.
+4. **Existing principal**: return user → downstream pipeline continues. The `allow_email_code_signin` check for existing users runs **later** in `validateLoginPermissions` against the **actually-resolved** login workspace (see post-auth section below). This matters for multi-workspace users: `resolveWorkspaceForLogin` prefers `LastLoginWorkspace`, which may differ from the first pre-invited workspace.
+5. **New principal (signup)** — workspace-level gates run here, BEFORE user creation, to prevent orphan accounts:
+ - Resolve pre-invited workspaces via `ListWorkspacesByEmail`.
+ - If a pre-invited workspace exists AND `allow_email_code_signin = false` → `FailedPrecondition` "email code login is not enabled for this workspace".
+ - If a pre-invited workspace exists AND `disallow_signup = true` → `Unauthenticated` "account not found" (generic, no enumeration).
+ - Fail closed on store errors (return `Internal`) — a transient read failure must not bypass either gate.
+ - If no resolvable workspace exists (SaaS first-time user): signup proceeds. `provisionWorkspaceForNewUser` creates a new workspace which inherits `allow_email_code_signin = true` via `getAdditionalWorkspaceSettings`.
+ - Generate random 32-byte string, bcrypt-hash it.
+ - Create principal: `email = email`, `name = email.split("@")[0]`, `type = END_USER`, `password_hash = hashedRandom`.
+ - Workspace assignment via `provisionWorkspaceForNewUser` (shared with password Signup RPC).
+ - Return new user → downstream pipeline continues.
+
+**Post-auth: updates to `validateLoginPermissions`** (required for SaaS):
+1. **Exempt email-code logins from `DisallowPasswordSignin`**: SaaS defaults to `DisallowPasswordSignin = true`, which blocks any non-IDP login. Add an `isEmailCodeLogin` branch that skips this check — email-code is a distinct auth method, not password.
+2. **Enforce `allow_email_code_signin` on the resolved workspace**: for email-code logins, verify the resolved `workspaceID` (from `resolveWorkspaceForLogin`) has `allow_email_code_signin = true`. Fails closed on store errors. This covers existing-user logins correctly even when the user's `LastLoginWorkspace` differs from their first pre-invited workspace.
+
+**Rate limiting:** `SendEmailLoginCode` has no workspace context and can't use audit-log-based counting (the audit middleware skips unauthenticated requests without workspace). The 60-second `last_sent_at` cooldown is the only rate limit, capping sends at ~60/hour/email. The cooldown check MUST be atomic with the row write to prevent a TOCTOU race: a conditional upsert (`INSERT ... ON CONFLICT DO UPDATE ... WHERE last_sent_at < now - cooldown RETURNING 1`) does the check-and-set in one statement. A separate read-then-write allows concurrent requests to both pass the cooldown and both send emails.
+
+### Shared helper: `verifyEmailCode(ctx, email, purpose, submittedCode) error`
+
+1. `GetEmailVerificationCode(email, purpose)`. If nil → `Unauthenticated` "invalid or expired code".
+2. `expires_at > now`? If not → `DeleteEmailVerificationCode` → `Unauthenticated` "invalid or expired code".
+3. `attempts < 5`? If at limit → `DeleteEmailVerificationCode` → `Unauthenticated` "too many attempts".
+4. Constant-time compare HMAC-SHA256(submittedCode, auth_secret) with `code_hash`. If mismatch → `IncrementEmailVerificationCodeAttempts` → `Unauthenticated` "invalid or expired code".
+5. On match: `DeleteEmailVerificationCode` (one-time use). Return nil.
+
+### `ResetPassword` — switch to code
+
+Body:
+1. `verifyEmailCode(ctx, email, PASSWORD_RESET, req.Msg.Code)`.
+2. Find user by email.
+3. bcrypt-hash `new_password`, update via `UpdateUser`.
+4. Revoke all refresh tokens for the user.
+
+### `RequestPasswordReset` — add cooldown + existence check
+
+The shared `sendEmailVerificationCode` helper enforces two safeguards for `PASSWORD_RESET`:
+1. **Principal existence check**: look up the email via `store.GetAccountByEmail`. If no principal (or not an `END_USER`), return silently without upserting a row or sending an email. Prevents the endpoint from being abused to send reset emails to arbitrary addresses.
+2. **Cooldown**: 60-sec `last_sent_at` check (same as LOGIN path).
+
+Both checks are internal to the helper; the RPC itself always returns `Empty` success regardless (no enumeration).
+
+The `LOGIN` purpose intentionally skips the existence check because it also handles signup (unknown-email → create principal).
+
+---
+
+## 5. Frontend
+
+### Login page (`Signin.vue`)
+
+Add a third tab next to "Standard" (password) and IDP tabs:
+
+- **Tab**: `t("auth.sign-in.email-code-tab")` = "Email code"
+- **Visibility**: `serverInfo?.allowEmailCodeSignin === true` (from actuator)
+
+**Two-step UI inside the tab:**
+
+```
+Step 1 (initial):
+ Email field
+ [ Send code ] button
+
+Step 2 (after Send code clicked):
+ Email field (disabled, "change" link to go back to step 1)
+ 6-digit code input (NInputOtp, autofocus)
+ [ Resend ] button (60-sec countdown)
+ [ Verify ] button (disabled until 6 digits; auto-submits on complete)
+```
+
+### Frontend store (`auth.ts`)
+
+- New: `sendEmailLoginCode(email)`
+- Existing: `login()` — just pass `emailCode` field
+
+### Code submission flow
+
+1. `authStore.login({ email, emailCode, web: true })`
+2. Same downstream as password login — if response has `mfaTempToken`, redirect to `MultiFactor.vue`. Otherwise `fetchCurrentUser()` + redirect to dashboard.
+
+### Resend countdown
+
+After "Send code" or "Resend", start a client-side 60-sec timer. Button shows `t("auth.sign-in.resend-in", { seconds: 45 })` while counting. Backend enforces the same window server-side regardless.
+
+### Password reset pages — complete rewrite
+
+**`PasswordForgot.vue`** (minor change):
+- Same email-input form. Copy updated from "link" to "code". Same "Send code" + cooldown UX.
+- On success, navigate to `password-reset?email=...`.
+
+**`PasswordReset.vue`** (complete rewrite):
+- No more `?token=` query param handling. No more token-based forced-reset-after-login flow (that flow is orthogonal; keep it via existing `UpdateUser` path).
+- Form:
+ - Email field (prefilled from query)
+ - 6-digit code input
+ - New password + confirm fields
+ - [ Resend code ] button (60-sec cooldown)
+ - [ Reset password ] button
+- On submit: `authServiceClientConnect.resetPassword({ email, code, newPassword })` → navigate to signin.
+
+### Pre-fill UX
+
+When user clicks "Forgot password?" on signin, carry `email` through: `password-forgot?email=...` → `password-reset?email=...`.
+
+### Removed from frontend
+
+- `auth/password-reset?token=xxx` query handling.
+- `GeneratePasswordResetToken` / reset-link construction in emails.
+
+### i18n (en-US + mirror to zh-CN, ja-JP, es-ES, vi-VN)
+
+```json
+"auth.sign-in.email-code-tab": "Email code",
+"auth.sign-in.send-code": "Send code",
+"auth.sign-in.resend-code": "Resend code",
+"auth.sign-in.resend-in": "Resend in {seconds}s",
+"auth.sign-in.code-sent-hint": "We've sent a 6-digit code to {email}",
+"auth.password-reset.code-label": "Verification code"
+```
+
+---
+
+## 6. Error Handling
+
+| Scenario | Response |
+|----------|----------|
+| `SendEmailLoginCode` with invalid email | `InvalidArgument` "invalid email" |
+| `SendEmailLoginCode` within 60s cooldown | `Empty` success (silent) |
+| `SendEmailLoginCode` no EMAIL setting + no `EMAIL_CONFIG` | `Empty` success, log warning |
+| `SendEmailLoginCode` SMTP send fails | `Empty` success, log warning (background) |
+| `Login` email_code + password or idp_name | `InvalidArgument` "mutually exclusive" |
+| `Login` email_code: no row for email | `Unauthenticated` "invalid or expired code" |
+| `Login` email_code: expired | Delete, `Unauthenticated` "invalid or expired code" |
+| `Login` email_code: attempts >= 5 | Delete, `Unauthenticated` "too many attempts" |
+| `Login` email_code: mismatch | Increment attempts, `Unauthenticated` "invalid or expired code" |
+| `Login` email_code: email unknown AND a resolvable pre-invited workspace has `disallow_signup=true` | `Unauthenticated` "account not found" (generic — don't leak why) |
+| `Login` email_code: pre-invited workspace has `allow_email_code_signin=false` | `FailedPrecondition` "email code login is not enabled for this workspace" (checked BEFORE any state mutation to prevent orphan accounts) |
+| `ResetPassword` — all code errors mirror Login branch | Same semantics |
+| `RequestPasswordReset` within 60s cooldown | `Empty` success (silent) |
+
+**Principles:**
+- No email enumeration: `SendEmailLoginCode` and `RequestPasswordReset` always return success.
+- Generic error message for all verification failures: "invalid or expired code". Exception: "too many attempts" is surfaced so the user knows to request a new code.
+- Constant-time compare for code hashes (matches existing `challengeRecoveryCode`).
+
+---
+
+## 7. Testing & Rollout
+
+### Unit tests
+
+- `backend/store/email_verification_code_test.go`:
+ - Upsert → Get → all fields match
+ - Upsert twice → second replaces first (attempts reset to 0)
+ - Two purposes for same email → coexist independently
+ - IncrementAttempts → atomic +1
+ - Delete → row gone
+ - DeleteExpired → only expired rows removed
+
+- `backend/api/v1/auth_service_test.go` (new cases):
+ - `verifyEmailCode`: happy, expired, attempts-exceeded, mismatch, missing row
+ - `authenticateLogin` email-code: existing user, new user (signup), mutually-exclusive rejection
+
+### Integration tests (`backend/tests/auth_test.go`)
+
+- `SendEmailLoginCode` + `Login(email_code)` happy path → token returned, user created if new
+- Resend within 60s → silently ignored, stored row unchanged
+- 5 wrong codes → 6th request returns "too many attempts", row deleted
+- Expired code (mock clock) → login fails
+- Password reset: `RequestPasswordReset` → `ResetPassword(email, code, new_password)` → can login with new password; old refresh tokens revoked
+- `allow_email_code_signin = false` on workspace → email-code login rejected
+- `disallow_signup = true` on workspace + unknown email → login rejected with "account not found"; existing user unaffected
+- 2FA interaction: TOTP-enabled user → email-code login returns `mfa_temp_token` → regular MFA flow completes
+
+### Migration & rollout
+
+- **Migration file**: `backend/migrator/migration/NNNN/0000_add_email_verification_code.sql`. Bump `TestLatestVersion`. Update `LATEST.sql`.
+- **Proto generation**: `cd proto && buf format -w . && buf lint && buf generate`.
+- **No feature flag**: gated by `allow_email_code_signin` workspace setting. Default `false` self-hosted. SaaS workspaces get `true` when `EMAIL_CONFIG` is set.
+- **Background cleanup**: add `DeleteExpiredEmailVerificationCodes` to the existing sweeper alongside `DeleteExpiredWebRefreshTokens`.
+- **Breaking change**: `ResetPassword` signature changes from `(token, new_password)` to `(email, code, new_password)`. Internal feature, 2 days old → acceptable. PR labeled `breaking`.
+- **Audit logs**: `SendEmailLoginCode`, `Login` (existing), `RequestPasswordReset` (existing), `ResetPassword` all have `option (bytebase.v1.audit) = true`.
diff --git a/frontend/src/types/proto-es/v1/actuator_service_pb.d.ts b/frontend/src/types/proto-es/v1/actuator_service_pb.d.ts
index 608b018447..0140de6421 100644
--- a/frontend/src/types/proto-es/v1/actuator_service_pb.d.ts
+++ b/frontend/src/types/proto-es/v1/actuator_service_pb.d.ts
@@ -87,6 +87,13 @@ export declare type Restriction = Message<"bytebase.v1.Restriction"> & {
* @generated from field: bytebase.v1.WorkspaceProfileSetting.PasswordRestriction password_restriction = 3;
*/
passwordRestriction?: WorkspaceProfileSetting_PasswordRestriction;
+
+ /**
+ * Whether email + 6-digit code signin is enabled for this workspace.
+ *
+ * @generated from field: bool allow_email_code_signin = 4;
+ */
+ allowEmailCodeSignin: boolean;
};
/**
diff --git a/frontend/src/types/proto-es/v1/actuator_service_pb.js b/frontend/src/types/proto-es/v1/actuator_service_pb.js
index 42912e345b..1aab3e981c 100644
--- a/frontend/src/types/proto-es/v1/actuator_service_pb.js
+++ b/frontend/src/types/proto-es/v1/actuator_service_pb.js
@@ -15,7 +15,7 @@ import { file_v1_setting_service } from "./setting_service_pb";
* Describes the file v1/actuator_service.proto.
*/
export const file_v1_actuator_service = /*@__PURE__*/
- fileDesc("Chl2MS9hY3R1YXRvcl9zZXJ2aWNlLnByb3Rv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_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_timestamp, file_v1_annotation, file_v1_setting_service]);
+ fileDesc("Chl2MS9hY3R1YXRvcl9zZXJ2aWNlLnByb3RvEgtieXRlYmFzZS52MSIUChJTZXR1cFNhbXBsZVJlcXVlc3QiQwoWR2V0QWN0dWF0b3JJbmZvUmVxdWVzdBIpCgRuYW1lGAEgASgJQhv6QRgKFmJ5dGViYXNlLmNvbS9Xb3Jrc3BhY2UiFAoSRGVsZXRlQ2FjaGVSZXF1ZXN0ItUBCgtSZXN0cmljdGlvbhIcCg9kaXNhbGxvd19zaWdudXAYASABKAhCA+BBAxIlChhkaXNhbGxvd19wYXNzd29yZF9zaWduaW4YAiABKAhCA+BBAxJbChRwYXNzd29yZF9yZXN0cmljdGlvbhgDIAEoCzI4LmJ5dGViYXNlLnYxLldvcmtzcGFjZVByb2ZpbGVTZXR0aW5nLlBhc3N3b3JkUmVzdHJpY3Rpb25CA+BBAxIkChdhbGxvd19lbWFpbF9jb2RlX3NpZ25pbhgEIAEoCEID4EEDIqUFCgxBY3R1YXRvckluZm8SFAoHdmVyc2lvbhgBIAEoCUID4EEDEhcKCmdpdF9jb21taXQYAiABKAlCA+BBAxIVCghyZWFkb25seRgDIAEoCEID4EEDEhEKBHNhYXMYBCABKAhCA+BBAxIRCgRkZW1vGAUgASgIQgPgQQMSEQoEaG9zdBgGIAEoCUID4EEDEhEKBHBvcnQYByABKAlCA+BBAxIZCgxleHRlcm5hbF91cmwYCCABKAlCA+BBAxI5ChBsYXN0X2FjdGl2ZV90aW1lGAsgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcEID4EEDEhYKCXdvcmtzcGFjZRgNIAEoCUID4EEDEiAKE3VubGljZW5zZWRfZmVhdHVyZXMYDyADKAlCA+BBAxITCgZkb2NrZXIYEiABKAhCA+BBAxIhChRhY3RpdmF0ZWRfdXNlcl9jb3VudBgTIAEoBUID4EEDEiUKGGFjdGl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bmQvZ2VuZXJhdGVkLWdvL3YxogIDQlhYqgILQnl0ZWJhc2UuVjHKAgtCeXRlYmFzZVxWMeICF0J5dGViYXNlXFYxXEdQQk1ldGFkYXRh6gIMQnl0ZWJhc2U6OlYxYgZwcm90bzM", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_timestamp, file_v1_annotation, file_v1_setting_service]);
/**
* Describes the message bytebase.v1.SetupSampleRequest.
diff --git a/frontend/src/types/proto-es/v1/auth_service_pb.d.ts b/frontend/src/types/proto-es/v1/auth_service_pb.d.ts
index 1bc2130598..8f7a5ace64 100644
--- a/frontend/src/types/proto-es/v1/auth_service_pb.d.ts
+++ b/frontend/src/types/proto-es/v1/auth_service_pb.d.ts
@@ -73,6 +73,14 @@ export declare type LoginRequest = Message<"bytebase.v1.LoginRequest"> & {
* @generated from field: optional string mfa_temp_token = 8;
*/
mfaTempToken?: string;
+
+ /**
+ * 6-digit code from email for passwordless login/signup.
+ * Pairs with `email`. Mutually exclusive with `password` and `idp_name`.
+ *
+ * @generated from field: optional string email_code = 9;
+ */
+ emailCode?: string;
};
/**
@@ -313,6 +321,94 @@ export declare type RefreshResponse = Message<"bytebase.v1.RefreshResponse"> & {
*/
export declare const RefreshResponseSchema: GenMessage<RefreshResponse>;
+/**
+ * @generated from message bytebase.v1.RequestPasswordResetRequest
+ */
+export declare type RequestPasswordResetRequest = Message<"bytebase.v1.RequestPasswordResetRequest"> & {
+ /**
+ * The email address of the account to reset.
+ *
+ * @generated from field: string email = 1;
+ */
+ email: string;
+
+ /**
+ * Optional workspace context captured at send time, used to locate the EMAIL setting,
+ * and later (at verify time) for signup gate checks and workspace assignment.
+ * Unset for SaaS brand-new signup (no workspace exists yet).
+ * Format: workspaces/{workspace}
+ *
+ * @generated from field: optional string workspace = 2;
+ */
+ workspace?: string;
+};
+
+/**
+ * Describes the message bytebase.v1.RequestPasswordResetRequest.
+ * Use `create(RequestPasswordResetRequestSchema)` to create a new message.
+ */
+export declare const RequestPasswordResetRequestSchema: GenMessage<RequestPasswordResetRequest>;
+
+/**
+ * @generated from message bytebase.v1.ResetPasswordRequest
+ */
+export declare type ResetPasswordRequest = Message<"bytebase.v1.ResetPasswordRequest"> & {
+ /**
+ * The email address of the account.
+ *
+ * @generated from field: string email = 1;
+ */
+ email: string;
+
+ /**
+ * The 6-digit code from the reset email.
+ *
+ * @generated from field: string code = 2;
+ */
+ code: string;
+
+ /**
+ * The new password to set.
+ *
+ * @generated from field: string new_password = 3;
+ */
+ newPassword: string;
+};
+
+/**
+ * Describes the message bytebase.v1.ResetPasswordRequest.
+ * Use `create(ResetPasswordRequestSchema)` to create a new message.
+ */
+export declare const ResetPasswordRequestSchema: GenMessage<ResetPasswordRequest>;
+
+/**
+ * @generated from message bytebase.v1.SendEmailLoginCodeRequest
+ */
+export declare type SendEmailLoginCodeRequest = Message<"bytebase.v1.SendEmailLoginCodeRequest"> & {
+ /**
+ * The email address to send the code to.
+ *
+ * @generated from field: string email = 1;
+ */
+ email: string;
+
+ /**
+ * Optional workspace context captured at send time, used to locate the EMAIL setting,
+ * and later (at verify time) for signup gate checks and workspace assignment.
+ * Unset for SaaS brand-new signup (no workspace exists yet).
+ * Format: workspaces/{workspace}
+ *
+ * @generated from field: optional string workspace = 2;
+ */
+ workspace?: string;
+};
+
+/**
+ * Describes the message bytebase.v1.SendEmailLoginCodeRequest.
+ * Use `create(SendEmailLoginCodeRequestSchema)` to create a new message.
+ */
+export declare const SendEmailLoginCodeRequestSchema: GenMessage<SendEmailLoginCodeRequest>;
+
/**
* @generated from message bytebase.v1.SwitchWorkspaceRequest
*/
@@ -435,5 +531,40 @@ export declare const AuthService: GenService<{
input: typeof SwitchWorkspaceRequestSchema;
output: typeof LoginResponseSchema;
},
+ /**
+ * Requests a password reset email for the given email address.
+ * Always returns success to avoid leaking whether the email exists.
+ * Permissions required: None
+ *
+ * @generated from rpc bytebase.v1.AuthService.RequestPasswordReset
+ */
+ requestPasswordReset: {
+ methodKind: "unary";
+ input: typeof RequestPasswordResetRequestSchema;
+ output: typeof EmptySchema;
+ },
+ /**
+ * Resets the user's password using a password reset token from email.
+ * Permissions required: None (validates via token)
+ *
+ * @generated from rpc bytebase.v1.AuthService.ResetPassword
+ */
+ resetPassword: {
+ methodKind: "unary";
+ input: typeof ResetPasswordRequestSchema;
+ output: typeof EmptySchema;
+ },
+ /**
+ * Sends a 6-digit verification code to the email for login/signup.
+ * Always returns success (no email enumeration). Enforces 60-sec resend cooldown.
+ * Permissions required: None
+ *
+ * @generated from rpc bytebase.v1.AuthService.SendEmailLoginCode
+ */
+ sendEmailLoginCode: {
+ methodKind: "unary";
+ input: typeof SendEmailLoginCodeRequestSchema;
+ output: typeof EmptySchema;
+ },
}>;
diff --git a/frontend/src/types/proto-es/v1/auth_service_pb.js b/frontend/src/types/proto-es/v1/auth_service_pb.js
index 3a28073305..1c02fdbaab 100644
--- a/frontend/src/types/proto-es/v1/auth_service_pb.js
+++ b/frontend/src/types/proto-es/v1/auth_service_pb.js
@@ -12,7 +12,7 @@ import { file_v1_user_service } from "./user_service_pb";
* Describes the file v1/auth_service.proto.
*/
export const file_v1_auth_service = /*@__PURE__*/
- fileDesc("ChV2MS9hdXRoX3NlcnZpY2UucHJvdG8SC2J5dGViYXNlLnYxIosCCgxMb2dpblJlcXVlc3QSDQoFZW1haWwYASABKAkSEAoIcGFzc3dvcmQYAiABKAkSCwoDd2ViGAMgASgIEhAKCGlkcF9uYW1lGAQgASgJEjkKC2lkcF9jb250ZXh0GAUgASgLMiQuYnl0ZWJhc2UudjEuSWRlbnRpdHlQcm92aWRlckNvbnRleHQSFQoIb3RwX2NvZGUYBiABKAlIAIgBARIaCg1yZWNvdmVyeV9jb2RlGAcgASgJSAGIAQESGwoObWZhX3RlbXBfdG9rZW4YCCABKAlIAogBAUILCglfb3RwX2NvZGVCEAoOX3JlY292ZXJ5X2NvZGVCEQoPX21mYV90ZW1wX3Rva2VuIqwBChdJZGVudGl0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Qnl0ZWJhc2VcVjHiAhdCeXRlYmFzZVxWMVxHUEJNZXRhZGF0YeoCDEJ5dGViYXNlOjpWMWIGcHJvdG8z", [file_google_api_annotations, file_google_protobuf_empty, file_v1_annotation, file_v1_user_service]);
+ fileDesc("ChV2MS9hdXRoX3NlcnZpY2UucHJvdG8SC2J5dGViYXNlLnYxIrMCCgxMb2dpblJlcXVlc3QSDQoFZW1haWwYASABKAkSEAoIcGFzc3dvcmQYAiABKAkSCwoDd2ViGAMgASgIEhAKCGlkcF9uYW1lGAQgASgJEjkKC2lkcF9jb250ZXh0GAUgASgLMiQuYnl0ZWJhc2UudjEuSWRlbnRpdHlQcm92aWRlckNvbnRleHQSFQoIb3RwX2NvZGUYBiABKAlIAIgBARIaCg1yZWNvdmVyeV9jb2RlGAcgASgJSAGIAQESGwoObWZhX3RlbXBfdG9rZW4YCCABKAlIAogBARIXCgplbWFpbF9jb2RlGAkgASgJSAOIAQFCCwoJX290cF9jb2RlQhAKDl9yZWNvdmVyeV9jb2RlQhEKD19tZmFfdGVtcF90b2tlbkINCgtfZW1haWxfY29kZSKsAQoXSWRlbnRpdHlQcm92aWRlckNvbnRleHQSRAoOb2F1dGgyX2NvbnRleHQYASABKAsyKi5ieXRlYmFzZS52MS5PQXV0aDJJZGVudGl0eVByb3ZpZGVyQ29udGV4dEgAEkAKDG9pZGNfY29udGV4dBgCIAEoCzIoLmJ5dGViYXNlLnYxLk9JRENJZGVudGl0eVByb3ZpZGVyQ29udGV4dEgAQgkKB2NvbnRleHQiLQodT0F1dGgySWRlbnRpdHlQcm92aWRlckNvbnRleHQSDAoEY29kZRgBIAEoCSIrChtPSURDSWRlbnRpdHlQcm92aWRlckNvbnRleHQSDAoEY29kZRgBIAEoCSKPAQoNTG9naW5SZXNwb25zZRINCgV0b2tlbhgBIAEoCRIbCg5tZmFfdGVtcF90b2tlbhgCIAEoCUgAiAEBEh4KFnJlcXVpcmVfcmVzZXRfcGFzc3dvcmQYAyABKAgSHwoEdXNlchg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kiJYDqMAGC0+STAhs6ASoiFi92MS9hdXRoOnJlc2V0UGFzc3dvcmQShAEKElNlbmRFbWFpbExvZ2luQ29kZRImLmJ5dGViYXNlLnYxLlNlbmRFbWFpbExvZ2luQ29kZVJlcXVlc3QaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiLoDqMAGY6jABgtPkkwIgOgEqIhsvdjEvYXV0aDpzZW5kRW1haWxMb2dpbkNvZGVCpgEKD2NvbS5ieXRlYmFzZS52MUIQQXV0aFNlcnZpY2VQcm90b1ABWjRnaXRodWIuY29tL2J5dGViYXNlL2J5dGViYXNlL2JhY2tlbmQvZ2VuZXJhdGVkLWdvL3YxogIDQlhYqgILQnl0ZWJhc2UuVjHKAgtCeXRlYmFzZVxWMeICF0J5dGViYXNlXFYxXEdQQk1ldGFkYXRh6gIMQnl0ZWJhc2U6OlYxYgZwcm90bzM", [file_google_api_annotations, file_google_protobuf_empty, file_v1_annotation, file_v1_user_service]);
/**
* Describes the message bytebase.v1.LoginRequest.
@@ -91,12 +91,33 @@ export const RefreshRequestSchema = /*@__PURE__*/
export const RefreshResponseSchema = /*@__PURE__*/
messageDesc(file_v1_auth_service, 10);
+/**
+ * Describes the message bytebase.v1.RequestPasswordResetRequest.
+ * Use `create(RequestPasswordResetRequestSchema)` to create a new message.
+ */
+export const RequestPasswordResetRequestSchema = /*@__PURE__*/
+ messageDesc(file_v1_auth_service, 11);
+
+/**
+ * Describes the message bytebase.v1.ResetPasswordRequest.
+ * Use `create(ResetPasswordRequestSchema)` to create a new message.
+ */
+export const ResetPasswordRequestSchema = /*@__PURE__*/
+ messageDesc(file_v1_auth_service, 12);
+
+/**
+ * Describes the message bytebase.v1.SendEmailLoginCodeRequest.
+ * Use `create(SendEmailLoginCodeRequestSchema)` to create a new message.
+ */
+export const SendEmailLoginCodeRequestSchema = /*@__PURE__*/
+ messageDesc(file_v1_auth_service, 13);
+
/**
* Describes the message bytebase.v1.SwitchWorkspaceRequest.
* Use `create(SwitchWorkspaceRequestSchema)` to create a new message.
*/
export const SwitchWorkspaceRequestSchema = /*@__PURE__*/
- messageDesc(file_v1_auth_service, 11);
+ messageDesc(file_v1_auth_service, 14);
/**
* AuthService handles user authentication operations.
diff --git a/frontend/src/types/proto-es/v1/setting_service_pb.d.ts b/frontend/src/types/proto-es/v1/setting_service_pb.d.ts
index c42dad7b28..2df317ea61 100644
--- a/frontend/src/types/proto-es/v1/setting_service_pb.d.ts
+++ b/frontend/src/types/proto-es/v1/setting_service_pb.d.ts
@@ -631,6 +631,14 @@ export declare type WorkspaceProfileSetting = Message<"bytebase.v1.WorkspaceProf
* @generated from field: google.protobuf.Duration query_timeout = 21;
*/
queryTimeout?: Duration;
+
+ /**
+ * Allow signin/signup using email + a 6-digit one-time verification code.
+ * Requires the EMAIL setting to be configured on the workspace.
+ *
+ * @generated from field: bool allow_email_code_signin = 22;
+ */
+ allowEmailCodeSignin: boolean;
};
/**
diff --git a/frontend/src/types/proto-es/v1/setting_service_pb.js b/frontend/src/types/proto-es/v1/setting_service_pb.js
index e1c5da696d..91bf3e8e21 100644
--- a/frontend/src/types/proto-es/v1/setting_service_pb.js
+++ b/frontend/src/types/proto-es/v1/setting_service_pb.js
@@ -17,7 +17,7 @@ import { file_v1_issue_service } from "./issue_service_pb";
* Describes the file v1/setting_service.proto.
*/
export const file_v1_setting_service = /*@__PURE__*/
- fileDesc("Chh2MS9zZXR0aW5nX3NlcnZpY2UucHJvdG8SC2J5dGViYXNlLnYxIhUKE0xpc3RTZXR0aW5nc1JlcXVlc3QiPgoUTGlzdFNldHRpbmdzUmVzcG9uc2USJgoIc2V0dGluZ3MYASADKAsyFC5ieXRlYmFzZS52MS5TZXR0aW5nIj8KEUdldFNldHRpbmdSZXF1ZXN0EioKBG5hbWUYASABKAlCHOBBAvpBFgoUYnl0ZWJhc2UuY29tL1NldHRpbmciOwoSR2V0U2V0dGluZ1Jlc3BvbnNlEiUKB3NldHRpbmcYASABKAsyFC5ieXRlYmFzZS52MS5TZXR0aW5n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nNlIi/aQQCK6jAQYmIuc2V0dGluZ3MubGlzdJDqMAGC0+STAg4SDC92MS9zZXR0aW5ncxJ/CgpHZXRTZXR0aW5nEh4uYnl0ZWJhc2UudjEuR2V0U2V0dGluZ1JlcXVlc3QaFC5ieXRlYmFzZS52MS5TZXR0aW5nIjvaQQRuYW1liuowD2JiLnNldHRpbmdzLmdldJDqMAKC0+STAhcSFS92MS97bmFtZT1zZXR0aW5ncy8qfRKTAQoNVXBkYXRlU2V0dGluZxIhLmJ5dGViYXNlLnYxLlVwZGF0ZVNldHRpbmdSZXF1ZXN0GhQuYnl0ZWJhc2UudjEuU2V0dGluZyJJiuowD2JiLnNldHRpbmdzLnNldJDqMAKY6jABgtPkkwIoOgdzZXR0aW5nMh0vdjEve3NldHRpbmcubmFtZT1zZXR0aW5ncy8qfRKwAQoQVGVzdEVtYWlsU2V0dGluZxIkLmJ5dGViYXNlLnYxLlRlc3RFbWFpbFNldHRpbmdSZXF1ZXN0GiUuYnl0ZWJhc2UudjEuVGVzdEVtYWlsU2V0dGluZ1Jlc3BvbnNlIk+K6jAPYmIuc2V0dGluZ3Muc2V0kOowAYLT5JMCMjoBKiItL3YxL3twYXJlbnQ9d29ya3NwYWNlcy8qfS9zZXR0aW5ncy9FTUFJTDp0ZXN0QqkBCg9jb20uYnl0ZWJhc2UudjFCE1NldHRpbmdTZXJ2aWNlUHJvdG9QAVo0Z2l0aHViLmNvbS9ieXRlYmFzZS9ieXRlYmFzZS9iYWNrZW5kL2dlbmVyYXRlZC1nby92MaICA0JYWKoCC0J5dGViYXNlLlYxygILQnl0ZWJhc2VcVjHiAhdCeXRlYmFzZVxWMVxHUEJNZXRhZGF0YeoCDEJ5dGViYXNlOjpWMWIGcHJvdG8z", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_duration, file_google_protobuf_field_mask, file_google_type_expr, file_v1_annotation, file_v1_common, file_v1_issue_service]);
+ fileDesc("Chh2MS9zZXR0aW5nX3N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FCE1NldHRpbmdTZXJ2aWNlUHJvdG9QAVo0Z2l0aHViLmNvbS9ieXRlYmFzZS9ieXRlYmFzZS9iYWNrZW5kL2dlbmVyYXRlZC1nby92MaICA0JYWKoCC0J5dGViYXNlLlYxygILQnl0ZWJhc2VcVjHiAhdCeXRlYmFzZVxWMVxHUEJNZXRhZGF0YeoCDEJ5dGViYXNlOjpWMWIGcHJvdG8z", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_duration, file_google_protobuf_field_mask, file_google_type_expr, file_v1_annotation, file_v1_common, file_v1_issue_service]);
/**
* Describes the message bytebase.v1.ListSettingsRequest.
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index e9a6cc25cb..848053ad3b 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -246,6 +246,74 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/bytebase.v1.ExchangeTokenResponse'
+ /v1/auth:requestPasswordReset:
+ post:
+ tags:
+ - AuthService
+ summary: RequestPasswordReset
+ description: |-
+ Requests a password reset email for the given email address.
+ Always returns success to avoid leaking whether the email exists.
+ Permissions required: None
+ operationId: AuthService_RequestPasswordReset
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.RequestPasswordResetRequest'
+ required: true
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/google.protobuf.Empty'
+ /v1/auth:resetPassword:
+ post:
+ tags:
+ - AuthService
+ summary: ResetPassword
+ description: |-
+ Resets the user's password using a password reset token from email.
+ Permissions required: None (validates via token)
+ operationId: AuthService_ResetPassword
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.ResetPasswordRequest'
+ required: true
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/google.protobuf.Empty'
+ /v1/auth:sendEmailLoginCode:
+ post:
+ tags:
+ - AuthService
+ summary: SendEmailLoginCode
+ description: |-
+ Sends a 6-digit verification code to the email for login/signup.
+ Always returns success (no email enumeration). Enforces 60-sec resend cooldown.
+ Permissions required: None
+ operationId: AuthService_SendEmailLoginCode
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.SendEmailLoginCodeRequest'
+ required: true
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/google.protobuf.Empty'
/v1/auth:switchWorkspace:
post:
tags:
@@ -23245,6 +23313,14 @@ components:
- "null"
title: mfa_temp_token
description: The mfa_temp_token is used to verify the user's identity by MFA.
+ emailCode:
+ type:
+ - string
+ - "null"
+ title: email_code
+ description: |-
+ 6-digit code from email for passwordless login/signup.
+ Pairs with `email`. Mutually exclusive with `password` and `idp_name`.
title: LoginRequest
additionalProperties: false
bytebase.v1.LoginResponse:
@@ -25265,6 +25341,42 @@ components:
title: RequestMetadata
additionalProperties: false
description: Metadata about the incoming request.
+ bytebase.v1.RequestPasswordResetRequest:
+ type: object
+ properties:
+ email:
+ type: string
+ title: email
+ description: The email address of the account to reset.
+ workspace:
+ type:
+ - string
+ - "null"
+ title: workspace
+ description: |-
+ Optional workspace context captured at send time, used to locate the EMAIL setting,
+ and later (at verify time) for signup gate checks and workspace assignment.
+ Unset for SaaS brand-new signup (no workspace exists yet).
+ Format: workspaces/{workspace}
+ title: RequestPasswordResetRequest
+ additionalProperties: false
+ bytebase.v1.ResetPasswordRequest:
+ type: object
+ properties:
+ email:
+ type: string
+ title: email
+ description: The email address of the account.
+ code:
+ type: string
+ title: code
+ description: The 6-digit code from the reset email.
+ newPassword:
+ type: string
+ title: new_password
+ description: The new password to set.
+ title: ResetPasswordRequest
+ additionalProperties: false
bytebase.v1.Restriction:
type: object
properties:
@@ -25283,6 +25395,11 @@ components:
description: Password complexity and restriction requirements.
readOnly: true
$ref: '#/components/schemas/bytebase.v1.WorkspaceProfileSetting.PasswordRestriction'
+ allowEmailCodeSignin:
+ type: boolean
+ title: allow_email_code_signin
+ description: Whether email + 6-digit code signin is enabled for this workspace.
+ readOnly: true
title: Restriction
additionalProperties: false
bytebase.v1.ReviewConfig:
@@ -26511,6 +26628,25 @@ components:
description: icon is the icon for semantic type, it can be emoji or base64 encoded image.
title: SemanticType
additionalProperties: false
+ bytebase.v1.SendEmailLoginCodeRequest:
+ type: object
+ properties:
+ email:
+ type: string
+ title: email
+ description: The email address to send the code to.
+ workspace:
+ type:
+ - string
+ - "null"
+ title: workspace
+ description: |-
+ Optional workspace context captured at send time, used to locate the EMAIL setting,
+ and later (at verify time) for signup gate checks and workspace assignment.
+ Unset for SaaS brand-new signup (no workspace exists yet).
+ Format: workspaces/{workspace}
+ title: SendEmailLoginCodeRequest
+ additionalProperties: false
bytebase.v1.SequenceMetadata:
type: object
properties:
@@ -29640,6 +29776,12 @@ components:
title: query_timeout
description: The query timeout duration for query and export, works for the SQL Editor and Export Center.
$ref: '#/components/schemas/google.protobuf.Duration'
+ allowEmailCodeSignin:
+ type: boolean
+ title: allow_email_code_signin
+ description: |-
+ Allow signin/signup using email + a 6-digit one-time verification code.
+ Requires the EMAIL setting to be configured on the workspace.
title: WorkspaceProfileSetting
additionalProperties: false
bytebase.v1.WorkspaceProfileSetting.PasswordRestriction:
diff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.md
index f4a1f07597..b704c7b6c4 100644
--- a/proto/gen/grpc-doc/store/README.md
+++ b/proto/gen/grpc-doc/store/README.md
@@ -41,6 +41,9 @@
- [AuditLog.Severity](#bytebase-store-AuditLog-Severity)
+- [store/auth.proto](#store_auth-proto)
+ - [EmailVerificationCodePurpose](#bytebase-store-EmailVerificationCodePurpose)
+
- [store/changelog.proto](#store_changelog-proto)
- [ChangelogPayload](#bytebase-store-ChangelogPayload)
@@ -873,6 +876,36 @@ Metadata about the request.
+<a name="store_auth-proto"></a>
+<p align="right"><a href="#top">Top</a></p>
+
+## store/auth.proto
+
+
+
+
+
+<a name="bytebase-store-EmailVerificationCodePurpose"></a>
+
+### EmailVerificationCodePurpose
+EmailVerificationCodePurpose distinguishes login codes from password reset codes.
+Stored as the enum name string in email_verification_code.purpose column.
+
+| Name | Number | Description |
+| ---- | ------ | ----------- |
+| EMAIL_VERIFICATION_CODE_PURPOSE_UNSPECIFIED | 0 | |
+| LOGIN | 1 | |
+| PASSWORD_RESET | 2 | |
+
+
+
+
+
+
+
+
+
+
<a name="store_changelog-proto"></a>
<p align="right"><a href="#top">Top</a></p>
@@ -4562,6 +4595,7 @@ All other settings live in per-workspace WORKSPACE_PROFILE.
| enable_debug | [bool](#bool) | | Whether debug mode is enabled. |
| sql_result_size | [int64](#int64) | | The maximum result size limit in bytes for query and export, works for the SQL Editor and Export Center. The default value is 100MB, we will use the default value if the setting not exists, or the limit &lt;= 0. |
| query_timeout | [google.protobuf.Duration](#google-protobuf-Duration) | | The query timeout duration for query and export, works for the SQL Editor and Export Center. |
+| allow_email_code_signin | [bool](#bool) | | Allow signin/signup using email &#43; a 6-digit one-time verification code. Requires the EMAIL setting to be configured on the workspace. |
diff --git a/proto/gen/grpc-doc/store/index.html b/proto/gen/grpc-doc/store/index.html
index e1639d02b4..2e71979978 100644
--- a/proto/gen/grpc-doc/store/index.html
+++ b/proto/gen/grpc-doc/store/index.html
@@ -321,6 +321,21 @@
</li>
+ <li>
+ <a href="#store%2fauth.proto">store/auth.proto</a>
+ <ul>
+
+
+ <li>
+ <a href="#bytebase.store.EmailVerificationCodePurpose"><span class="badge">E</span>EmailVerificationCodePurpose</a>
+ </li>
+
+
+
+ </ul>
+ </li>
+
+
<li>
<a href="#store%2fchangelog.proto">store/changelog.proto</a>
<ul>
@@ -2934,6 +2949,49 @@ This information is not authenticated and should be treated accordingly. </p></t
+ <div class="file-heading">
+ <h2 id="store/auth.proto">store/auth.proto</h2><a href="#title">Top</a>
+ </div>
+ <p></p>
+
+
+
+
+ <h3 id="bytebase.store.EmailVerificationCodePurpose">EmailVerificationCodePurpose</h3>
+ <p>EmailVerificationCodePurpose distinguishes login codes from password reset codes.</p><p>Stored as the enum name string in email_verification_code.purpose column.</p>
+ <table class="enum-table">
+ <thead>
+ <tr><td>Name</td><td>Number</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>EMAIL_VERIFICATION_CODE_PURPOSE_UNSPECIFIED</td>
+ <td>0</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>LOGIN</td>
+ <td>1</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>PASSWORD_RESET</td>
+ <td>2</td>
+ <td><p></p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
+
+
+
+
+
+
<div class="file-heading">
<h2 id="store/changelog.proto">store/changelog.proto</h2><a href="#title">Top</a>
</div>
@@ -12544,6 +12602,14 @@ The default value is 100MB, we will use the default value if the setting not exi
<td><p>The query timeout duration for query and export, works for the SQL Editor and Export Center. </p></td>
</tr>
+ <tr>
+ <td>allow_email_code_signin</td>
+ <td><a href="#bool">bool</a></td>
+ <td></td>
+ <td><p>Allow signin/signup using email &#43; a 6-digit one-time verification code.
+Requires the EMAIL setting to be configured on the workspace. </p></td>
+ </tr>
+
</tbody>
</table>
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index a5eb4d277c..a466bd5f95 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -200,6 +200,9 @@
- [OIDCIdentityProviderContext](#bytebase-v1-OIDCIdentityProviderContext)
- [RefreshRequest](#bytebase-v1-RefreshRequest)
- [RefreshResponse](#bytebase-v1-RefreshResponse)
+ - [RequestPasswordResetRequest](#bytebase-v1-RequestPasswordResetRequest)
+ - [ResetPasswordRequest](#bytebase-v1-ResetPasswordRequest)
+ - [SendEmailLoginCodeRequest](#bytebase-v1-SendEmailLoginCodeRequest)
- [SignupRequest](#bytebase-v1-SignupRequest)
- [SwitchWorkspaceRequest](#bytebase-v1-SwitchWorkspaceRequest)
@@ -2488,6 +2491,7 @@ For examples: resource.environment_id == &#34;prod&#34; &amp;&amp; statement.aff
| enable_debug | [bool](#bool) | | Whether debug mode is enabled. |
| sql_result_size | [int64](#int64) | | The maximum result size limit in bytes for query and export, works for the SQL Editor and Export Center. The default value is 100MB, we will use the default value if the setting not exists, or the limit &lt;= 0. |
| query_timeout | [google.protobuf.Duration](#google-protobuf-Duration) | | The query timeout duration for query and export, works for the SQL Editor and Export Center. |
+| allow_email_code_signin | [bool](#bool) | | Allow signin/signup using email &#43; a 6-digit one-time verification code. Requires the EMAIL setting to be configured on the workspace. |
@@ -2747,6 +2751,7 @@ Request message for getting actuator information.
| disallow_signup | [bool](#bool) | | Whether self-service user signup is disabled. |
| disallow_password_signin | [bool](#bool) | | Whether password-based signin is disabled (except for workspace admins). |
| password_restriction | [WorkspaceProfileSetting.PasswordRestriction](#bytebase-v1-WorkspaceProfileSetting-PasswordRestriction) | | Password complexity and restriction requirements. |
+| allow_email_code_signin | [bool](#bool) | | Whether email &#43; 6-digit code signin is enabled for this workspace. |
@@ -3553,6 +3558,7 @@ Context for identity provider authentication.
| otp_code | [string](#string) | optional | The otp_code is used to verify the user&#39;s identity by MFA. |
| recovery_code | [string](#string) | optional | The recovery_code is used to recovery the user&#39;s identity with MFA. |
| mfa_temp_token | [string](#string) | optional | The mfa_temp_token is used to verify the user&#39;s identity by MFA. |
+| email_code | [string](#string) | optional | 6-digit code from email for passwordless login/signup. Pairs with `email`. Mutually exclusive with `password` and `idp_name`. |
@@ -3637,6 +3643,55 @@ Response from refreshing the access token.
+<a name="bytebase-v1-RequestPasswordResetRequest"></a>
+
+### RequestPasswordResetRequest
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| email | [string](#string) | | The email address of the account to reset. |
+| workspace | [string](#string) | optional | Optional workspace context captured at send time, used to locate the EMAIL setting, and later (at verify time) for signup gate checks and workspace assignment. Unset for SaaS brand-new signup (no workspace exists yet). Format: workspaces/{workspace} |
+
+
+
+
+
+
+<a name="bytebase-v1-ResetPasswordRequest"></a>
+
+### ResetPasswordRequest
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| email | [string](#string) | | The email address of the account. |
+| code | [string](#string) | | The 6-digit code from the reset email. |
+| new_password | [string](#string) | | The new password to set. |
+
+
+
+
+
+
+<a name="bytebase-v1-SendEmailLoginCodeRequest"></a>
+
+### SendEmailLoginCodeRequest
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| email | [string](#string) | | The email address to send the code to. |
+| workspace | [string](#string) | optional | Optional workspace context captured at send time, used to locate the EMAIL setting, and later (at verify time) for signup gate checks and workspace assignment. Unset for SaaS brand-new signup (no workspace exists yet). Format: workspaces/{workspace} |
+
+
+
+
+
+
<a name="bytebase-v1-SignupRequest"></a>
### SignupRequest
@@ -3692,6 +3747,9 @@ AuthService handles user authentication operations.
| Signup | [SignupRequest](#bytebase-v1-SignupRequest) | [LoginResponse](#bytebase-v1-LoginResponse) | Registers a new user account. Creates a principal and assigns a workspace: - If the user&#39;s email was pre-invited to a workspace, joins that workspace. - Otherwise, creates a new workspace with the user as admin. Returns access tokens so the user is logged in immediately after signup. |
| Refresh | [RefreshRequest](#bytebase-v1-RefreshRequest) | [RefreshResponse](#bytebase-v1-RefreshResponse) | Refreshes the access token using the refresh token cookie. Permissions required: None (validates via refresh token cookie) |
| SwitchWorkspace | [SwitchWorkspaceRequest](#bytebase-v1-SwitchWorkspaceRequest) | [LoginResponse](#bytebase-v1-LoginResponse) | Switches the current user&#39;s active workspace and issues new tokens. The user must be a member of the target workspace. |
+| RequestPasswordReset | [RequestPasswordResetRequest](#bytebase-v1-RequestPasswordResetRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | Requests a password reset email for the given email address. Always returns success to avoid leaking whether the email exists. Permissions required: None |
+| ResetPassword | [ResetPasswordRequest](#bytebase-v1-ResetPasswordRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | Resets the user&#39;s password using a password reset token from email. Permissions required: None (validates via token) |
+| SendEmailLoginCode | [SendEmailLoginCodeRequest](#bytebase-v1-SendEmailLoginCodeRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | Sends a 6-digit verification code to the email for login/signup. Always returns success (no email enumeration). Enforces 60-sec resend cooldown. Permissions required: None |
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index 9424a47ccf..fc3ae51415 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -932,6 +932,18 @@
<a href="#bytebase.v1.RefreshResponse"><span class="badge">M</span>RefreshResponse</a>
</li>
+ <li>
+ <a href="#bytebase.v1.RequestPasswordResetRequest"><span class="badge">M</span>RequestPasswordResetRequest</a>
+ </li>
+
+ <li>
+ <a href="#bytebase.v1.ResetPasswordRequest"><span class="badge">M</span>ResetPasswordRequest</a>
+ </li>
+
+ <li>
+ <a href="#bytebase.v1.SendEmailLoginCodeRequest"><span class="badge">M</span>SendEmailLoginCodeRequest</a>
+ </li>
+
<li>
<a href="#bytebase.v1.SignupRequest"><span class="badge">M</span>SignupRequest</a>
</li>
@@ -7643,6 +7655,14 @@ The default value is 100MB, we will use the default value if the setting not exi
<td><p>The query timeout duration for query and export, works for the SQL Editor and Export Center. </p></td>
</tr>
+ <tr>
+ <td>allow_email_code_signin</td>
+ <td><a href="#bool">bool</a></td>
+ <td></td>
+ <td><p>Allow signin/signup using email &#43; a 6-digit one-time verification code.
+Requires the EMAIL setting to be configured on the workspace. </p></td>
+ </tr>
+
</tbody>
</table>
@@ -8409,6 +8429,13 @@ or no workspace-scoped fields are returned (SaaS). </p></td>
<td><p>Password complexity and restriction requirements. </p></td>
</tr>
+ <tr>
+ <td>allow_email_code_signin</td>
+ <td><a href="#bool">bool</a></td>
+ <td></td>
+ <td><p>Whether email &#43; 6-digit code signin is enabled for this workspace. </p></td>
+ </tr>
+
</tbody>
</table>
@@ -10533,6 +10560,14 @@ Format: idps/{idp} </p></td>
<td><p>The mfa_temp_token is used to verify the user&#39;s identity by MFA. </p></td>
</tr>
+ <tr>
+ <td>email_code</td>
+ <td><a href="#string">string</a></td>
+ <td>optional</td>
+ <td><p>6-digit code from email for passwordless login/signup.
+Pairs with `email`. Mutually exclusive with `password` and `idp_name`. </p></td>
+ </tr>
+
</tbody>
</table>
@@ -10655,6 +10690,112 @@ Only returned when web=false. For web=true, the token is set as an HTTP-only coo
+ <h3 id="bytebase.v1.RequestPasswordResetRequest">RequestPasswordResetRequest</h3>
+ <p></p>
+
+
+ <table class="field-table">
+ <thead>
+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>email</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The email address of the account to reset. </p></td>
+ </tr>
+
+ <tr>
+ <td>workspace</td>
+ <td><a href="#string">string</a></td>
+ <td>optional</td>
+ <td><p>Optional workspace context captured at send time, used to locate the EMAIL setting,
+and later (at verify time) for signup gate checks and workspace assignment.
+Unset for SaaS brand-new signup (no workspace exists yet).
+Format: workspaces/{workspace} </p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
+
+
+
+
+ <h3 id="bytebase.v1.ResetPasswordRequest">ResetPasswordRequest</h3>
+ <p></p>
+
+
+ <table class="field-table">
+ <thead>
+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>email</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The email address of the account. </p></td>
+ </tr>
+
+ <tr>
+ <td>code</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The 6-digit code from the reset email. </p></td>
+ </tr>
+
+ <tr>
+ <td>new_password</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The new password to set. </p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
+
+
+
+
+ <h3 id="bytebase.v1.SendEmailLoginCodeRequest">SendEmailLoginCodeRequest</h3>
+ <p></p>
+
+
+ <table class="field-table">
+ <thead>
+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>email</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The email address to send the code to. </p></td>
+ </tr>
+
+ <tr>
+ <td>workspace</td>
+ <td><a href="#string">string</a></td>
+ <td>optional</td>
+ <td><p>Optional workspace context captured at send time, used to locate the EMAIL setting,
+and later (at verify time) for signup gate checks and workspace assignment.
+Unset for SaaS brand-new signup (no workspace exists yet).
+Format: workspaces/{workspace} </p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
+
+
+
+
<h3 id="bytebase.v1.SignupRequest">SignupRequest</h3>
<p></p>
@@ -10811,6 +10952,32 @@ Permissions required: None (validates via refresh token cookie)</p></td>
The user must be a member of the target workspace.</p></td>
</tr>
+ <tr>
+ <td>RequestPasswordReset</td>
+ <td><a href="#bytebase.v1.RequestPasswordResetRequest">RequestPasswordResetRequest</a></td>
+ <td><a href="#google.protobuf.Empty">.google.protobuf.Empty</a></td>
+ <td><p>Requests a password reset email for the given email address.
+Always returns success to avoid leaking whether the email exists.
+Permissions required: None</p></td>
+ </tr>
+
+ <tr>
+ <td>ResetPassword</td>
+ <td><a href="#bytebase.v1.ResetPasswordRequest">ResetPasswordRequest</a></td>
+ <td><a href="#google.protobuf.Empty">.google.protobuf.Empty</a></td>
+ <td><p>Resets the user&#39;s password using a password reset token from email.
+Permissions required: None (validates via token)</p></td>
+ </tr>
+
+ <tr>
+ <td>SendEmailLoginCode</td>
+ <td><a href="#bytebase.v1.SendEmailLoginCodeRequest">SendEmailLoginCodeRequest</a></td>
+ <td><a href="#google.protobuf.Empty">.google.protobuf.Empty</a></td>
+ <td><p>Sends a 6-digit verification code to the email for login/signup.
+Always returns success (no email enumeration). Enforces 60-sec resend cooldown.
+Permissions required: None</p></td>
+ </tr>
+
</tbody>
</table>
@@ -10889,6 +11056,36 @@ The user must be a member of the target workspace.</p></td>
</tr>
+
+
+ <tr>
+ <td>RequestPasswordReset</td>
+ <td>POST</td>
+ <td>/v1/auth:requestPasswordReset</td>
+ <td>*</td>
+ </tr>
+
+
+
+
+ <tr>
+ <td>ResetPassword</td>
+ <td>POST</td>
+ <td>/v1/auth:resetPassword</td>
+ <td>*</td>
+ </tr>
+
+
+
+
+ <tr>
+ <td>SendEmailLoginCode</td>
+ <td>POST</td>
+ <td>/v1/auth:sendEmailLoginCode</td>
+ <td>*</td>
+ </tr>
+
+
</tbody>
</table>
diff --git a/proto/store/store/auth.proto b/proto/store/store/auth.proto
new file mode 100644
index 0000000000..e8b354a5fa
--- /dev/null
+++ b/proto/store/store/auth.proto
@@ -0,0 +1,13 @@
+syntax = "proto3";
+
+package bytebase.store;
+
+option go_package = "generated-go/store";
+
+// EmailVerificationCodePurpose distinguishes login codes from password reset codes.
+// Stored as the enum name string in email_verification_code.purpose column.
+enum EmailVerificationCodePurpose {
+ EMAIL_VERIFICATION_CODE_PURPOSE_UNSPECIFIED = 0;
+ LOGIN = 1;
+ PASSWORD_RESET = 2;
+}
diff --git a/proto/store/store/setting.proto b/proto/store/store/setting.proto
index d2ce5af8db..c9397072b5 100644
--- a/proto/store/store/setting.proto
+++ b/proto/store/store/setting.proto
@@ -144,6 +144,10 @@ message WorkspaceProfileSetting {
// The query timeout duration for query and export, works for the SQL Editor and Export Center.
google.protobuf.Duration query_timeout = 21;
+
+ // Allow signin/signup using email + a 6-digit one-time verification code.
+ // Requires the EMAIL setting to be configured on the workspace.
+ bool allow_email_code_signin = 22;
}
message WorkspaceApprovalSetting {
diff --git a/proto/v1/v1/actuator_service.proto b/proto/v1/v1/actuator_service.proto
index 6ccb125393..d66f3ff264 100644
--- a/proto/v1/v1/actuator_service.proto
+++ b/proto/v1/v1/actuator_service.proto
@@ -71,6 +71,9 @@ message Restriction {
// Password complexity and restriction requirements.
WorkspaceProfileSetting.PasswordRestriction password_restriction = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
+
+ // Whether email + 6-digit code signin is enabled for this workspace.
+ bool allow_email_code_signin = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
}
// System information and configuration for the Bytebase instance.
diff --git a/proto/v1/v1/auth_service.proto b/proto/v1/v1/auth_service.proto
index f6e4df9231..0d675907b1 100644
--- a/proto/v1/v1/auth_service.proto
+++ b/proto/v1/v1/auth_service.proto
@@ -77,6 +77,39 @@ service AuthService {
};
option (bytebase.v1.auth_method) = CUSTOM;
}
+
+ // Requests a password reset email for the given email address.
+ // Always returns success to avoid leaking whether the email exists.
+ // Permissions required: None
+ rpc RequestPasswordReset(RequestPasswordResetRequest) returns (google.protobuf.Empty) {
+ option (google.api.http) = {
+ post: "/v1/auth:requestPasswordReset"
+ body: "*"
+ };
+ option (bytebase.v1.allow_without_credential) = true;
+ }
+
+ // Resets the user's password using a password reset token from email.
+ // Permissions required: None (validates via token)
+ rpc ResetPassword(ResetPasswordRequest) returns (google.protobuf.Empty) {
+ option (google.api.http) = {
+ post: "/v1/auth:resetPassword"
+ body: "*"
+ };
+ option (bytebase.v1.allow_without_credential) = true;
+ }
+
+ // Sends a 6-digit verification code to the email for login/signup.
+ // Always returns success (no email enumeration). Enforces 60-sec resend cooldown.
+ // Permissions required: None
+ rpc SendEmailLoginCode(SendEmailLoginCodeRequest) returns (google.protobuf.Empty) {
+ option (google.api.http) = {
+ post: "/v1/auth:sendEmailLoginCode"
+ body: "*"
+ };
+ option (bytebase.v1.allow_without_credential) = true;
+ option (bytebase.v1.audit) = true;
+ }
}
message LoginRequest {
@@ -105,6 +138,10 @@ message LoginRequest {
// The mfa_temp_token is used to verify the user's identity by MFA.
optional string mfa_temp_token = 8;
+
+ // 6-digit code from email for passwordless login/signup.
+ // Pairs with `email`. Mutually exclusive with `password` and `idp_name`.
+ optional string email_code = 9;
}
// Context for identity provider authentication.
@@ -178,6 +215,35 @@ message RefreshRequest {}
// Response from refreshing the access token.
message RefreshResponse {}
+message RequestPasswordResetRequest {
+ // The email address of the account to reset.
+ string email = 1;
+ // Optional workspace context captured at send time, used to locate the EMAIL setting,
+ // and later (at verify time) for signup gate checks and workspace assignment.
+ // Unset for SaaS brand-new signup (no workspace exists yet).
+ // Format: workspaces/{workspace}
+ optional string workspace = 2;
+}
+
+message ResetPasswordRequest {
+ // The email address of the account.
+ string email = 1;
+ // The 6-digit code from the reset email.
+ string code = 2;
+ // The new password to set.
+ string new_password = 3;
+}
+
+message SendEmailLoginCodeRequest {
+ // The email address to send the code to.
+ string email = 1;
+ // Optional workspace context captured at send time, used to locate the EMAIL setting,
+ // and later (at verify time) for signup gate checks and workspace assignment.
+ // Unset for SaaS brand-new signup (no workspace exists yet).
+ // Format: workspaces/{workspace}
+ optional string workspace = 2;
+}
+
message SwitchWorkspaceRequest {
// The target workspace to switch to.
// Format: workspaces/{workspace}
diff --git a/proto/v1/v1/setting_service.proto b/proto/v1/v1/setting_service.proto
index f4bf6690ba..af70746bbd 100644
--- a/proto/v1/v1/setting_service.proto
+++ b/proto/v1/v1/setting_service.proto
@@ -264,6 +264,10 @@ message WorkspaceProfileSetting {
// The query timeout duration for query and export, works for the SQL Editor and Export Center.
google.protobuf.Duration query_timeout = 21;
+
+ // Allow signin/signup using email + a 6-digit one-time verification code.
+ // Requires the EMAIL setting to be configured on the workspace.
+ bool allow_email_code_signin = 22;
}
message Announcement {