Exemplo n.º 1
0
        public async Task <RegisterOutput> Register(RegisterInput input)
        {
            var user = await _userRegistrationManager.RegisterAsync(
                input.Name,
                input.Surname,
                input.EmailAddress,
                input.UserName,
                input.Password,
                true // Assumed email address is always confirmed. Change this if you want to implement email confirmation.
                );

            _notificationSubscriptionManager.SubscribeToAllAvailableNotifications(user.ToUserIdentifier());
            await _appNotifier.WelcomeToTheApplicationAsync(user);


            var notification = _userNotificationManager.GetUserNotifications(user.ToUserIdentifier());

            await _realTimeNotifier.SendNotificationsAsync(notification.ToArray());

            var isEmailConfirmationRequiredForLogin = await SettingManager.GetSettingValueAsync <bool>(AbpZeroSettingNames.UserManagement.IsEmailConfirmationRequiredForLogin);

            return(new RegisterOutput
            {
                CanLogin = user.IsActive && (user.IsEmailConfirmed || !isEmailConfirmationRequiredForLogin)
            });
        }