mirror of
https://github.com/zitadel/zitadel.git
synced 2025-02-25 18:55:27 -06:00
fix: user init mail (for wrong email) (#891)
* add resendInitialMail * disable email notifications (when not initialised) * fix resend init mail * add tests * cleanup * cleanup * fix tests * add resend trigger, dialog * refactor contact component, add sendinitmail fnc * skip email if empty * reload user on phone email changes, i18n warndialog on dl * lint * rebuild mgmt proto * remove initial focus * Update console/src/assets/i18n/de.json Co-authored-by: Fabi <38692350+fgerschwiler@users.noreply.github.com> Co-authored-by: Max Peintner <max@caos.ch> Co-authored-by: Fabi <38692350+fgerschwiler@users.noreply.github.com>
This commit is contained in:
@@ -184,6 +184,11 @@ var ManagementService_AuthMethods = authz.MethodMapping{
|
||||
CheckParam: "",
|
||||
},
|
||||
|
||||
"/caos.zitadel.management.api.v1.ManagementService/ResendInitialMail": authz.Option{
|
||||
Permission: "user.write",
|
||||
CheckParam: "",
|
||||
},
|
||||
|
||||
"/caos.zitadel.management.api.v1.ManagementService/SearchUserMemberships": authz.Option{
|
||||
Permission: "user.membership.read",
|
||||
CheckParam: "",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -4316,6 +4316,82 @@ var _ interface {
|
||||
ErrorName() string
|
||||
} = SetPasswordNotificationRequestValidationError{}
|
||||
|
||||
// Validate checks the field values on InitialMailRequest with the rules
|
||||
// defined in the proto definition for this message. If any rules are
|
||||
// violated, an error is returned.
|
||||
func (m *InitialMailRequest) Validate() error {
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
if utf8.RuneCountInString(m.GetId()) < 1 {
|
||||
return InitialMailRequestValidationError{
|
||||
field: "Id",
|
||||
reason: "value length must be at least 1 runes",
|
||||
}
|
||||
}
|
||||
|
||||
// no validation rules for Email
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// InitialMailRequestValidationError is the validation error returned by
|
||||
// InitialMailRequest.Validate if the designated constraints aren't met.
|
||||
type InitialMailRequestValidationError struct {
|
||||
field string
|
||||
reason string
|
||||
cause error
|
||||
key bool
|
||||
}
|
||||
|
||||
// Field function returns field value.
|
||||
func (e InitialMailRequestValidationError) Field() string { return e.field }
|
||||
|
||||
// Reason function returns reason value.
|
||||
func (e InitialMailRequestValidationError) Reason() string { return e.reason }
|
||||
|
||||
// Cause function returns cause value.
|
||||
func (e InitialMailRequestValidationError) Cause() error { return e.cause }
|
||||
|
||||
// Key function returns key value.
|
||||
func (e InitialMailRequestValidationError) Key() bool { return e.key }
|
||||
|
||||
// ErrorName returns error name.
|
||||
func (e InitialMailRequestValidationError) ErrorName() string {
|
||||
return "InitialMailRequestValidationError"
|
||||
}
|
||||
|
||||
// Error satisfies the builtin error interface
|
||||
func (e InitialMailRequestValidationError) Error() string {
|
||||
cause := ""
|
||||
if e.cause != nil {
|
||||
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||||
}
|
||||
|
||||
key := ""
|
||||
if e.key {
|
||||
key = "key for "
|
||||
}
|
||||
|
||||
return fmt.Sprintf(
|
||||
"invalid %sInitialMailRequest.%s: %s%s",
|
||||
key,
|
||||
e.field,
|
||||
e.reason,
|
||||
cause)
|
||||
}
|
||||
|
||||
var _ error = InitialMailRequestValidationError{}
|
||||
|
||||
var _ interface {
|
||||
Field() string
|
||||
Reason() string
|
||||
Key() bool
|
||||
Cause() error
|
||||
ErrorName() string
|
||||
} = InitialMailRequestValidationError{}
|
||||
|
||||
// Validate checks the field values on OrgIamPolicyView with the rules defined
|
||||
// in the proto definition for this message. If any rules are violated, an
|
||||
// error is returned.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2157,6 +2157,26 @@ func (mr *MockManagementServiceClientMockRecorder) ResendEmailVerificationMail(a
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResendEmailVerificationMail", reflect.TypeOf((*MockManagementServiceClient)(nil).ResendEmailVerificationMail), varargs...)
|
||||
}
|
||||
|
||||
// ResendInitialMail mocks base method
|
||||
func (m *MockManagementServiceClient) ResendInitialMail(arg0 context.Context, arg1 *management.InitialMailRequest, arg2 ...grpc.CallOption) (*emptypb.Empty, error) {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0, arg1}
|
||||
for _, a := range arg2 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
ret := m.ctrl.Call(m, "ResendInitialMail", varargs...)
|
||||
ret0, _ := ret[0].(*emptypb.Empty)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// ResendInitialMail indicates an expected call of ResendInitialMail
|
||||
func (mr *MockManagementServiceClientMockRecorder) ResendInitialMail(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0, arg1}, arg2...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResendInitialMail", reflect.TypeOf((*MockManagementServiceClient)(nil).ResendInitialMail), varargs...)
|
||||
}
|
||||
|
||||
// ResendPhoneVerificationCode mocks base method
|
||||
func (m *MockManagementServiceClient) ResendPhoneVerificationCode(arg0 context.Context, arg1 *management.UserID, arg2 ...grpc.CallOption) (*emptypb.Empty, error) {
|
||||
m.ctrl.T.Helper()
|
||||
|
||||
@@ -424,6 +424,17 @@ rpc GetUserByID(UserID) returns (UserView) {
|
||||
};
|
||||
}
|
||||
|
||||
rpc ResendInitialMail(InitialMailRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {
|
||||
post: "/users/{id}/_resendinitialisation"
|
||||
body: "*"
|
||||
};
|
||||
|
||||
option (caos.zitadel.utils.v1.auth_option) = {
|
||||
permission: "user.write"
|
||||
};
|
||||
}
|
||||
|
||||
rpc SearchUserMemberships(UserMembershipSearchRequest) returns (UserMembershipSearchResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/users/{user_id}/memberships/_search"
|
||||
@@ -2049,6 +2060,11 @@ enum NotificationType {
|
||||
NOTIFICATIONTYPE_SMS = 1;
|
||||
}
|
||||
|
||||
message InitialMailRequest {
|
||||
string id = 1 [(validate.rules).string.min_len = 1];
|
||||
string email = 2;
|
||||
}
|
||||
|
||||
enum PolicyState {
|
||||
POLICYSTATE_UNSPECIFIED = 0;
|
||||
POLICYSTATE_ACTIVE = 1;
|
||||
|
||||
Reference in New Issue
Block a user