]> git.mxchange.org Git - friendica.git/commitdiff
Ensure that the actor name can't be changed
authorMichael <heluecht@pirati.ca>
Sat, 22 Aug 2020 19:40:31 +0000 (19:40 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 22 Aug 2020 19:40:31 +0000 (19:40 +0000)
src/Model/User.php
src/Module/Admin/Site.php

index 2a954e6e609c6853ca63efe455aaaccb10fdaecb..c329ef91a3ab990f3693d6b36c8400c815333be8 100644 (file)
@@ -175,6 +175,14 @@ class User
        {
                $system_actor_name = DI::config()->get('system', 'actor_name');
                if (!empty($system_actor_name)) {
+                       $self = Contact::selectFirst(['nick'], ['uid' => 0, 'self' => true]);
+                       if (!empty($self['nick'])) {
+                               if ($self['nick'] != $system_actor_name) {
+                                       // Reset the actor name to the already used name
+                                       DI::config()->set('system', 'actor_name', $self['nick']);
+                                       $system_actor_name = $self['nick'];
+                               }
+                       }
                        return $system_actor_name;
                }
 
@@ -680,7 +688,6 @@ class User
        {
                $forbidden_nicknames = DI::config()->get('system', 'forbidden_nicknames', '');
                if (!empty($forbidden_nicknames)) {
-                       // check if the nickname is in the list of blocked nicknames
                        $forbidden = explode(',', $forbidden_nicknames);
                        $forbidden = array_map('trim', $forbidden);
                } else {
@@ -697,6 +704,7 @@ class User
                        return false;
                }
 
+               // check if the nickname is in the list of blocked nicknames
                if (in_array(strtolower($nickname), $forbidden)) {
                        return true;
                }
index 64b9395dad7bed89de55ae0ba88fa490c674a84b..de1ba5f8b36db0627559aac0cbb08e693664d066 100644 (file)
@@ -603,7 +603,7 @@ class Site extends BaseAdmin
                        // name, label, value, help string, extra data...
                        '$sitename'         => ['sitename', DI::l10n()->t('Site name'), DI::config()->get('config', 'sitename'), ''],
                        '$sender_email'     => ['sender_email', DI::l10n()->t('Sender Email'), DI::config()->get('config', 'sender_email'), DI::l10n()->t('The email address your server shall use to send notification emails from.'), '', '', 'email'],
-                       '$system_actor_name' => ['system_actor_name', DI::l10n()->t('Name of the system actor'), User::getActorName(), DI::l10n()->t("Name of the internal system account that is used to perform ActivityPub requests. This must be an unused username. If set, this shouldn't be changed again.")],
+                       '$system_actor_name' => ['system_actor_name', DI::l10n()->t('Name of the system actor'), User::getActorName(), DI::l10n()->t("Name of the internal system account that is used to perform ActivityPub requests. This must be an unused username. If set, this can't be changed again.")],
                        '$banner'           => ['banner', DI::l10n()->t('Banner/Logo'), $banner, ''],
                        '$email_banner'     => ['email_banner', DI::l10n()->t('Email Banner/Logo'), $email_banner, ''],
                        '$shortcut_icon'    => ['shortcut_icon', DI::l10n()->t('Shortcut icon'), DI::config()->get('system', 'shortcut_icon'), DI::l10n()->t('Link to an icon that will be used for browsers.')],