2021-06-10 11:49:10 +00:00
|
|
|
package admin
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
feat(console): message and login texts, privacy policy (#2016)
* message texts wrapper components
* message-text sub, i18n, grid
* fix routing
* pack
* pack
* update material
* audit
* fix mgmt service for labelplcy
* map conv
* edit text from map
* request map
* fetch data, mgmt admin service
* warn box, i18n
* resetbtn
* login texts
* login text requests
* reset, default, i18n
* disabled, features, message text setter, service
* locale switcher
* policy grid
* password reset, domain claimed i18n
* lint files
* fix admin service, i18n, lang setter
* fix scss duplicate
* privacy policy, cleanup grid, fix message, login texts (#2031)
* policy grid everywhere 🦒
* cleanup home
* log login text request
* patch all data
* refresh toggle
* fix: add dialog for unsaved changes (#2057)
* logintexts dialog
* check for dialog on pairwise operation
* fix: patch value to local state after save
* fix: i18n and custom login texts (#2060)
* fix: i18n and custom login texts
* fix: tos and privacy texts
* fix frontend
* fix: tos and privacy texts and tests
* fix: i18n, tos and privacy texts and tests
* fix frontend maps
* i18n
* add ResetCustomLoginTextToDefault in admin api and fix template remove in handlers
* resetlogintexttodefault
Co-authored-by: Livio Amstutz <livio.a@gmail.com>
2021-07-26 10:44:45 +00:00
|
|
|
"golang.org/x/text/language"
|
|
|
|
|
2022-04-26 23:01:45 +00:00
|
|
|
"github.com/zitadel/zitadel/internal/api/authz"
|
|
|
|
"github.com/zitadel/zitadel/internal/api/grpc/object"
|
|
|
|
text_grpc "github.com/zitadel/zitadel/internal/api/grpc/text"
|
|
|
|
"github.com/zitadel/zitadel/internal/domain"
|
|
|
|
admin_pb "github.com/zitadel/zitadel/pkg/grpc/admin"
|
2021-06-10 11:49:10 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func (s *Server) GetDefaultInitMessageText(ctx context.Context, req *admin_pb.GetDefaultInitMessageTextRequest) (*admin_pb.GetDefaultInitMessageTextResponse, error) {
|
2022-04-25 09:16:36 +00:00
|
|
|
msg, err := s.query.DefaultMessageTextByTypeAndLanguageFromFileSystem(ctx, domain.InitCodeMessageType, req.Language)
|
2021-06-10 11:49:10 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &admin_pb.GetDefaultInitMessageTextResponse{
|
2021-12-16 14:21:37 +00:00
|
|
|
CustomText: text_grpc.ModelCustomMessageTextToPb(msg),
|
2021-07-13 05:13:39 +00:00
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) GetCustomInitMessageText(ctx context.Context, req *admin_pb.GetCustomInitMessageTextRequest) (*admin_pb.GetCustomInitMessageTextResponse, error) {
|
2022-11-30 16:01:17 +00:00
|
|
|
msg, err := s.query.CustomMessageTextByTypeAndLanguage(ctx, authz.GetInstance(ctx).InstanceID(), domain.InitCodeMessageType, req.Language, false)
|
2021-07-13 05:13:39 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &admin_pb.GetCustomInitMessageTextResponse{
|
2021-12-16 14:21:37 +00:00
|
|
|
CustomText: text_grpc.ModelCustomMessageTextToPb(msg),
|
2021-06-10 11:49:10 +00:00
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) SetDefaultInitMessageText(ctx context.Context, req *admin_pb.SetDefaultInitMessageTextRequest) (*admin_pb.SetDefaultInitMessageTextResponse, error) {
|
2022-04-05 05:58:09 +00:00
|
|
|
result, err := s.command.SetDefaultMessageText(ctx, authz.GetInstance(ctx).InstanceID(), SetInitCustomTextToDomain(req))
|
2021-06-10 11:49:10 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &admin_pb.SetDefaultInitMessageTextResponse{
|
|
|
|
Details: object.ChangeToDetailsPb(
|
|
|
|
result.Sequence,
|
|
|
|
result.EventDate,
|
|
|
|
result.ResourceOwner,
|
|
|
|
),
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
2022-02-04 09:25:25 +00:00
|
|
|
func (s *Server) ResetCustomInitMessageTextToDefault(ctx context.Context, req *admin_pb.ResetCustomInitMessageTextToDefaultRequest) (*admin_pb.ResetCustomInitMessageTextToDefaultResponse, error) {
|
2022-03-24 16:21:34 +00:00
|
|
|
result, err := s.command.RemoveInstanceMessageTexts(ctx, domain.InitCodeMessageType, language.Make(req.Language))
|
2022-02-04 09:25:25 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &admin_pb.ResetCustomInitMessageTextToDefaultResponse{
|
|
|
|
Details: object.ChangeToDetailsPb(
|
|
|
|
result.Sequence,
|
|
|
|
result.EventDate,
|
|
|
|
result.ResourceOwner,
|
|
|
|
),
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
2021-06-10 11:49:10 +00:00
|
|
|
func (s *Server) GetDefaultPasswordResetMessageText(ctx context.Context, req *admin_pb.GetDefaultPasswordResetMessageTextRequest) (*admin_pb.GetDefaultPasswordResetMessageTextResponse, error) {
|
2022-04-25 09:16:36 +00:00
|
|
|
msg, err := s.query.DefaultMessageTextByTypeAndLanguageFromFileSystem(ctx, domain.PasswordResetMessageType, req.Language)
|
2021-06-10 11:49:10 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &admin_pb.GetDefaultPasswordResetMessageTextResponse{
|
2021-12-16 14:21:37 +00:00
|
|
|
CustomText: text_grpc.ModelCustomMessageTextToPb(msg),
|
2021-07-13 05:13:39 +00:00
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) GetCustomPasswordResetMessageText(ctx context.Context, req *admin_pb.GetCustomPasswordResetMessageTextRequest) (*admin_pb.GetCustomPasswordResetMessageTextResponse, error) {
|
2022-11-30 16:01:17 +00:00
|
|
|
msg, err := s.query.CustomMessageTextByTypeAndLanguage(ctx, authz.GetInstance(ctx).InstanceID(), domain.PasswordResetMessageType, req.Language, false)
|
2021-07-13 05:13:39 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &admin_pb.GetCustomPasswordResetMessageTextResponse{
|
2021-12-16 14:21:37 +00:00
|
|
|
CustomText: text_grpc.ModelCustomMessageTextToPb(msg),
|
2021-06-10 11:49:10 +00:00
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) SetDefaultPasswordResetMessageText(ctx context.Context, req *admin_pb.SetDefaultPasswordResetMessageTextRequest) (*admin_pb.SetDefaultPasswordResetMessageTextResponse, error) {
|
2022-04-05 05:58:09 +00:00
|
|
|
result, err := s.command.SetDefaultMessageText(ctx, authz.GetInstance(ctx).InstanceID(), SetPasswordResetCustomTextToDomain(req))
|
2021-06-10 11:49:10 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &admin_pb.SetDefaultPasswordResetMessageTextResponse{
|
|
|
|
Details: object.ChangeToDetailsPb(
|
|
|
|
result.Sequence,
|
|
|
|
result.EventDate,
|
|
|
|
result.ResourceOwner,
|
|
|
|
),
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
2022-02-04 09:25:25 +00:00
|
|
|
func (s *Server) ResetCustomPasswordResetMessageTextToDefault(ctx context.Context, req *admin_pb.ResetCustomPasswordResetMessageTextToDefaultRequest) (*admin_pb.ResetCustomPasswordResetMessageTextToDefaultResponse, error) {
|
2022-03-24 16:21:34 +00:00
|
|
|
result, err := s.command.RemoveInstanceMessageTexts(ctx, domain.PasswordResetMessageType, language.Make(req.Language))
|
2022-02-04 09:25:25 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &admin_pb.ResetCustomPasswordResetMessageTextToDefaultResponse{
|
|
|
|
Details: object.ChangeToDetailsPb(
|
|
|
|
result.Sequence,
|
|
|
|
result.EventDate,
|
|
|
|
result.ResourceOwner,
|
|
|
|
),
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
2021-06-10 11:49:10 +00:00
|
|
|
func (s *Server) GetDefaultVerifyEmailMessageText(ctx context.Context, req *admin_pb.GetDefaultVerifyEmailMessageTextRequest) (*admin_pb.GetDefaultVerifyEmailMessageTextResponse, error) {
|
2022-04-25 09:16:36 +00:00
|
|
|
msg, err := s.query.DefaultMessageTextByTypeAndLanguageFromFileSystem(ctx, domain.VerifyEmailMessageType, req.Language)
|
2021-06-10 11:49:10 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &admin_pb.GetDefaultVerifyEmailMessageTextResponse{
|
2021-12-16 14:21:37 +00:00
|
|
|
CustomText: text_grpc.ModelCustomMessageTextToPb(msg),
|
2021-07-13 05:13:39 +00:00
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) GetCustomVerifyEmailMessageText(ctx context.Context, req *admin_pb.GetCustomVerifyEmailMessageTextRequest) (*admin_pb.GetCustomVerifyEmailMessageTextResponse, error) {
|
2022-11-30 16:01:17 +00:00
|
|
|
msg, err := s.query.CustomMessageTextByTypeAndLanguage(ctx, authz.GetInstance(ctx).InstanceID(), domain.VerifyEmailMessageType, req.Language, false)
|
2021-07-13 05:13:39 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &admin_pb.GetCustomVerifyEmailMessageTextResponse{
|
2021-12-16 14:21:37 +00:00
|
|
|
CustomText: text_grpc.ModelCustomMessageTextToPb(msg),
|
2021-06-10 11:49:10 +00:00
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
2021-07-20 09:40:53 +00:00
|
|
|
func (s *Server) SetDefaultVerifyEmailMessageText(ctx context.Context, req *admin_pb.SetDefaultVerifyEmailMessageTextRequest) (*admin_pb.SetDefaultVerifyEmailMessageTextResponse, error) {
|
2022-04-05 05:58:09 +00:00
|
|
|
result, err := s.command.SetDefaultMessageText(ctx, authz.GetInstance(ctx).InstanceID(), SetVerifyEmailCustomTextToDomain(req))
|
2021-06-10 11:49:10 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &admin_pb.SetDefaultVerifyEmailMessageTextResponse{
|
|
|
|
Details: object.ChangeToDetailsPb(
|
|
|
|
result.Sequence,
|
|
|
|
result.EventDate,
|
|
|
|
result.ResourceOwner,
|
|
|
|
),
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
2022-02-04 09:25:25 +00:00
|
|
|
func (s *Server) ResetCustomVerifyEmailMessageTextToDefault(ctx context.Context, req *admin_pb.ResetCustomVerifyEmailMessageTextToDefaultRequest) (*admin_pb.ResetCustomVerifyEmailMessageTextToDefaultResponse, error) {
|
2022-03-24 16:21:34 +00:00
|
|
|
result, err := s.command.RemoveInstanceMessageTexts(ctx, domain.VerifyEmailMessageType, language.Make(req.Language))
|
2022-02-04 09:25:25 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &admin_pb.ResetCustomVerifyEmailMessageTextToDefaultResponse{
|
|
|
|
Details: object.ChangeToDetailsPb(
|
|
|
|
result.Sequence,
|
|
|
|
result.EventDate,
|
|
|
|
result.ResourceOwner,
|
|
|
|
),
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
2021-06-10 11:49:10 +00:00
|
|
|
func (s *Server) GetDefaultVerifyPhoneMessageText(ctx context.Context, req *admin_pb.GetDefaultVerifyPhoneMessageTextRequest) (*admin_pb.GetDefaultVerifyPhoneMessageTextResponse, error) {
|
2022-04-25 09:16:36 +00:00
|
|
|
msg, err := s.query.DefaultMessageTextByTypeAndLanguageFromFileSystem(ctx, domain.VerifyPhoneMessageType, req.Language)
|
2021-06-10 11:49:10 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &admin_pb.GetDefaultVerifyPhoneMessageTextResponse{
|
2021-12-16 14:21:37 +00:00
|
|
|
CustomText: text_grpc.ModelCustomMessageTextToPb(msg),
|
2021-07-13 05:13:39 +00:00
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) GetCustomVerifyPhoneMessageText(ctx context.Context, req *admin_pb.GetCustomVerifyPhoneMessageTextRequest) (*admin_pb.GetCustomVerifyPhoneMessageTextResponse, error) {
|
2022-11-30 16:01:17 +00:00
|
|
|
msg, err := s.query.CustomMessageTextByTypeAndLanguage(ctx, authz.GetInstance(ctx).InstanceID(), domain.VerifyPhoneMessageType, req.Language, false)
|
2021-07-13 05:13:39 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &admin_pb.GetCustomVerifyPhoneMessageTextResponse{
|
2021-12-16 14:21:37 +00:00
|
|
|
CustomText: text_grpc.ModelCustomMessageTextToPb(msg),
|
2021-06-10 11:49:10 +00:00
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) SetDefaultVerifyPhoneMessageText(ctx context.Context, req *admin_pb.SetDefaultVerifyPhoneMessageTextRequest) (*admin_pb.SetDefaultVerifyPhoneMessageTextResponse, error) {
|
2022-04-05 05:58:09 +00:00
|
|
|
result, err := s.command.SetDefaultMessageText(ctx, authz.GetInstance(ctx).InstanceID(), SetVerifyPhoneCustomTextToDomain(req))
|
2021-06-10 11:49:10 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &admin_pb.SetDefaultVerifyPhoneMessageTextResponse{
|
|
|
|
Details: object.ChangeToDetailsPb(
|
|
|
|
result.Sequence,
|
|
|
|
result.EventDate,
|
|
|
|
result.ResourceOwner,
|
|
|
|
),
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
2022-02-04 09:25:25 +00:00
|
|
|
func (s *Server) ResetCustomVerifyPhoneMessageTextToDefault(ctx context.Context, req *admin_pb.ResetCustomVerifyPhoneMessageTextToDefaultRequest) (*admin_pb.ResetCustomVerifyPhoneMessageTextToDefaultResponse, error) {
|
2022-03-24 16:21:34 +00:00
|
|
|
result, err := s.command.RemoveInstanceMessageTexts(ctx, domain.VerifyPhoneMessageType, language.Make(req.Language))
|
2022-02-04 09:25:25 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &admin_pb.ResetCustomVerifyPhoneMessageTextToDefaultResponse{
|
|
|
|
Details: object.ChangeToDetailsPb(
|
|
|
|
result.Sequence,
|
|
|
|
result.EventDate,
|
|
|
|
result.ResourceOwner,
|
|
|
|
),
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
2021-06-10 11:49:10 +00:00
|
|
|
func (s *Server) GetDefaultDomainClaimedMessageText(ctx context.Context, req *admin_pb.GetDefaultDomainClaimedMessageTextRequest) (*admin_pb.GetDefaultDomainClaimedMessageTextResponse, error) {
|
2022-04-25 09:16:36 +00:00
|
|
|
msg, err := s.query.DefaultMessageTextByTypeAndLanguageFromFileSystem(ctx, domain.DomainClaimedMessageType, req.Language)
|
2021-06-10 11:49:10 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &admin_pb.GetDefaultDomainClaimedMessageTextResponse{
|
2021-12-16 14:21:37 +00:00
|
|
|
CustomText: text_grpc.ModelCustomMessageTextToPb(msg),
|
2021-07-13 05:13:39 +00:00
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) GetCustomDomainClaimedMessageText(ctx context.Context, req *admin_pb.GetCustomDomainClaimedMessageTextRequest) (*admin_pb.GetCustomDomainClaimedMessageTextResponse, error) {
|
2022-11-30 16:01:17 +00:00
|
|
|
msg, err := s.query.CustomMessageTextByTypeAndLanguage(ctx, authz.GetInstance(ctx).InstanceID(), domain.DomainClaimedMessageType, req.Language, false)
|
2021-07-13 05:13:39 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &admin_pb.GetCustomDomainClaimedMessageTextResponse{
|
2021-12-16 14:21:37 +00:00
|
|
|
CustomText: text_grpc.ModelCustomMessageTextToPb(msg),
|
2021-06-10 11:49:10 +00:00
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) SetDefaultDomainClaimedMessageText(ctx context.Context, req *admin_pb.SetDefaultDomainClaimedMessageTextRequest) (*admin_pb.SetDefaultDomainClaimedMessageTextResponse, error) {
|
2022-04-05 05:58:09 +00:00
|
|
|
result, err := s.command.SetDefaultMessageText(ctx, authz.GetInstance(ctx).InstanceID(), SetDomainClaimedCustomTextToDomain(req))
|
2021-06-10 11:49:10 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &admin_pb.SetDefaultDomainClaimedMessageTextResponse{
|
|
|
|
Details: object.ChangeToDetailsPb(
|
|
|
|
result.Sequence,
|
|
|
|
result.EventDate,
|
|
|
|
result.ResourceOwner,
|
|
|
|
),
|
|
|
|
}, nil
|
|
|
|
}
|
2021-07-05 13:10:49 +00:00
|
|
|
|
2022-02-04 09:25:25 +00:00
|
|
|
func (s *Server) ResetCustomDomainClaimedMessageTextToDefault(ctx context.Context, req *admin_pb.ResetCustomDomainClaimedMessageTextToDefaultRequest) (*admin_pb.ResetCustomDomainClaimedMessageTextToDefaultResponse, error) {
|
2022-03-24 16:21:34 +00:00
|
|
|
result, err := s.command.RemoveInstanceMessageTexts(ctx, domain.DomainClaimedMessageType, language.Make(req.Language))
|
2022-02-04 09:25:25 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &admin_pb.ResetCustomDomainClaimedMessageTextToDefaultResponse{
|
|
|
|
Details: object.ChangeToDetailsPb(
|
|
|
|
result.Sequence,
|
|
|
|
result.EventDate,
|
|
|
|
result.ResourceOwner,
|
|
|
|
),
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
2021-08-02 13:24:58 +00:00
|
|
|
func (s *Server) GetDefaultPasswordlessRegistrationMessageText(ctx context.Context, req *admin_pb.GetDefaultPasswordlessRegistrationMessageTextRequest) (*admin_pb.GetDefaultPasswordlessRegistrationMessageTextResponse, error) {
|
2022-04-25 09:16:36 +00:00
|
|
|
msg, err := s.query.DefaultMessageTextByTypeAndLanguageFromFileSystem(ctx, domain.PasswordlessRegistrationMessageType, req.Language)
|
2021-08-02 13:24:58 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &admin_pb.GetDefaultPasswordlessRegistrationMessageTextResponse{
|
2021-12-16 14:21:37 +00:00
|
|
|
CustomText: text_grpc.ModelCustomMessageTextToPb(msg),
|
2021-08-02 13:24:58 +00:00
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) GetCustomPasswordlessRegistrationMessageText(ctx context.Context, req *admin_pb.GetCustomPasswordlessRegistrationMessageTextRequest) (*admin_pb.GetCustomPasswordlessRegistrationMessageTextResponse, error) {
|
2022-11-30 16:01:17 +00:00
|
|
|
msg, err := s.query.CustomMessageTextByTypeAndLanguage(ctx, authz.GetInstance(ctx).InstanceID(), domain.PasswordlessRegistrationMessageType, req.Language, false)
|
2021-08-02 13:24:58 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &admin_pb.GetCustomPasswordlessRegistrationMessageTextResponse{
|
2021-12-16 14:21:37 +00:00
|
|
|
CustomText: text_grpc.ModelCustomMessageTextToPb(msg),
|
2021-08-02 13:24:58 +00:00
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) SetDefaultPasswordlessRegistrationMessageText(ctx context.Context, req *admin_pb.SetDefaultPasswordlessRegistrationMessageTextRequest) (*admin_pb.SetDefaultPasswordlessRegistrationMessageTextResponse, error) {
|
2022-04-05 05:58:09 +00:00
|
|
|
result, err := s.command.SetDefaultMessageText(ctx, authz.GetInstance(ctx).InstanceID(), SetPasswordlessRegistrationCustomTextToDomain(req))
|
2021-08-02 13:24:58 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &admin_pb.SetDefaultPasswordlessRegistrationMessageTextResponse{
|
|
|
|
Details: object.ChangeToDetailsPb(
|
|
|
|
result.Sequence,
|
|
|
|
result.EventDate,
|
|
|
|
result.ResourceOwner,
|
|
|
|
),
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
2022-02-04 09:25:25 +00:00
|
|
|
func (s *Server) ResetCustomPasswordlessRegistrationMessageTextToDefault(ctx context.Context, req *admin_pb.ResetCustomPasswordlessRegistrationMessageTextToDefaultRequest) (*admin_pb.ResetCustomPasswordlessRegistrationMessageTextToDefaultResponse, error) {
|
2022-03-24 16:21:34 +00:00
|
|
|
result, err := s.command.RemoveInstanceMessageTexts(ctx, domain.PasswordlessRegistrationMessageType, language.Make(req.Language))
|
2022-02-04 09:25:25 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &admin_pb.ResetCustomPasswordlessRegistrationMessageTextToDefaultResponse{
|
|
|
|
Details: object.ChangeToDetailsPb(
|
|
|
|
result.Sequence,
|
|
|
|
result.EventDate,
|
|
|
|
result.ResourceOwner,
|
|
|
|
),
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
2021-07-05 13:10:49 +00:00
|
|
|
func (s *Server) GetDefaultLoginTexts(ctx context.Context, req *admin_pb.GetDefaultLoginTextsRequest) (*admin_pb.GetDefaultLoginTextsResponse, error) {
|
2021-12-16 14:21:37 +00:00
|
|
|
msg, err := s.query.GetDefaultLoginTexts(ctx, req.Language)
|
2021-07-05 13:10:49 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &admin_pb.GetDefaultLoginTextsResponse{
|
|
|
|
CustomText: text_grpc.CustomLoginTextToPb(msg),
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
func (s *Server) GetCustomLoginTexts(ctx context.Context, req *admin_pb.GetCustomLoginTextsRequest) (*admin_pb.GetCustomLoginTextsResponse, error) {
|
2022-04-05 05:58:09 +00:00
|
|
|
msg, err := s.query.GetCustomLoginTexts(ctx, authz.GetInstance(ctx).InstanceID(), req.Language)
|
2021-07-05 13:10:49 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &admin_pb.GetCustomLoginTextsResponse{
|
|
|
|
CustomText: text_grpc.CustomLoginTextToPb(msg),
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) SetCustomLoginText(ctx context.Context, req *admin_pb.SetCustomLoginTextsRequest) (*admin_pb.SetCustomLoginTextsResponse, error) {
|
2022-03-24 16:21:34 +00:00
|
|
|
result, err := s.command.SetCustomInstanceLoginText(ctx, SetLoginTextToDomain(req))
|
2021-07-05 13:10:49 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &admin_pb.SetCustomLoginTextsResponse{
|
|
|
|
Details: object.ChangeToDetailsPb(
|
|
|
|
result.Sequence,
|
|
|
|
result.EventDate,
|
|
|
|
result.ResourceOwner,
|
|
|
|
),
|
|
|
|
}, nil
|
|
|
|
}
|
feat(console): message and login texts, privacy policy (#2016)
* message texts wrapper components
* message-text sub, i18n, grid
* fix routing
* pack
* pack
* update material
* audit
* fix mgmt service for labelplcy
* map conv
* edit text from map
* request map
* fetch data, mgmt admin service
* warn box, i18n
* resetbtn
* login texts
* login text requests
* reset, default, i18n
* disabled, features, message text setter, service
* locale switcher
* policy grid
* password reset, domain claimed i18n
* lint files
* fix admin service, i18n, lang setter
* fix scss duplicate
* privacy policy, cleanup grid, fix message, login texts (#2031)
* policy grid everywhere 🦒
* cleanup home
* log login text request
* patch all data
* refresh toggle
* fix: add dialog for unsaved changes (#2057)
* logintexts dialog
* check for dialog on pairwise operation
* fix: patch value to local state after save
* fix: i18n and custom login texts (#2060)
* fix: i18n and custom login texts
* fix: tos and privacy texts
* fix frontend
* fix: tos and privacy texts and tests
* fix: i18n, tos and privacy texts and tests
* fix frontend maps
* i18n
* add ResetCustomLoginTextToDefault in admin api and fix template remove in handlers
* resetlogintexttodefault
Co-authored-by: Livio Amstutz <livio.a@gmail.com>
2021-07-26 10:44:45 +00:00
|
|
|
|
|
|
|
func (s *Server) ResetCustomLoginTextToDefault(ctx context.Context, req *admin_pb.ResetCustomLoginTextsToDefaultRequest) (*admin_pb.ResetCustomLoginTextsToDefaultResponse, error) {
|
2022-03-24 16:21:34 +00:00
|
|
|
result, err := s.command.RemoveCustomInstanceLoginTexts(ctx, language.Make(req.Language))
|
feat(console): message and login texts, privacy policy (#2016)
* message texts wrapper components
* message-text sub, i18n, grid
* fix routing
* pack
* pack
* update material
* audit
* fix mgmt service for labelplcy
* map conv
* edit text from map
* request map
* fetch data, mgmt admin service
* warn box, i18n
* resetbtn
* login texts
* login text requests
* reset, default, i18n
* disabled, features, message text setter, service
* locale switcher
* policy grid
* password reset, domain claimed i18n
* lint files
* fix admin service, i18n, lang setter
* fix scss duplicate
* privacy policy, cleanup grid, fix message, login texts (#2031)
* policy grid everywhere 🦒
* cleanup home
* log login text request
* patch all data
* refresh toggle
* fix: add dialog for unsaved changes (#2057)
* logintexts dialog
* check for dialog on pairwise operation
* fix: patch value to local state after save
* fix: i18n and custom login texts (#2060)
* fix: i18n and custom login texts
* fix: tos and privacy texts
* fix frontend
* fix: tos and privacy texts and tests
* fix: i18n, tos and privacy texts and tests
* fix frontend maps
* i18n
* add ResetCustomLoginTextToDefault in admin api and fix template remove in handlers
* resetlogintexttodefault
Co-authored-by: Livio Amstutz <livio.a@gmail.com>
2021-07-26 10:44:45 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &admin_pb.ResetCustomLoginTextsToDefaultResponse{
|
|
|
|
Details: object.ChangeToDetailsPb(
|
|
|
|
result.Sequence,
|
|
|
|
result.EventDate,
|
|
|
|
result.ResourceOwner,
|
|
|
|
),
|
|
|
|
}, nil
|
|
|
|
}
|