Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions LoginOIDC.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,12 @@ private function shouldHandleRememberMe() : bool
*/
public function getStylesheetFiles(array &$files)
{
$settings = new SystemSettings();
$hidePasswordLogin = $settings->hidePasswordLogin->getValue();
$files[] = "plugins/LoginOIDC/stylesheets/loginMod.css";
if ($hidePasswordLogin) {
$files[] = "plugins/LoginOIDC/stylesheets/loginModHidePwLogin.css";
}
}

/**
Expand Down
22 changes: 22 additions & 0 deletions SystemSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ class SystemSettings extends \Piwik\Settings\Plugin\SystemSettings
*/
public $disableDirectLoginUrl;

/**
* Whether to hide standard password login form.
*
* @var bool
*/
public $hidePasswordLogin;

/**
* Whether new Matomo accounts should be created for unknown users
*
Expand Down Expand Up @@ -149,6 +156,7 @@ protected function init()
$this->disableSuperuser = $this->createDisableSuperuserSetting();
$this->disablePasswordConfirmation = $this->createDisablePasswordConfirmationSetting();
$this->disableDirectLoginUrl = $this->createDisableDirectLoginUrlSetting();
$this->hidePasswordLogin = $this->createHidePasswordLoginSetting();
$this->allowSignup = $this->createAllowSignupSetting();
$this->bypassTwoFa = $this->createBypassTwoFaSetting();
$this->autoLinking = $this->createAutoLinkingSetting();
Expand Down Expand Up @@ -206,6 +214,20 @@ private function createDisableDirectLoginUrlSetting() : SystemSetting
$field->uiControl = FieldConfig::UI_CONTROL_CHECKBOX;
});
}

/**
* Add hide password login setting.
*
* @return SystemSetting
*/
private function createHidePasswordLoginSetting() : SystemSetting
{
return $this->makeSetting("hidePasswordLogin", $default = false, FieldConfig::TYPE_BOOL, function(FieldConfig $field) {
$field->title = Piwik::translate("LoginOIDC_SettingHidePasswordLogin");
$field->description = Piwik::translate("LoginOIDC_SettingHidePasswordLoginHelp");
$field->uiControl = FieldConfig::UI_CONTROL_CHECKBOX;
});
}

/**
* Add allowSignup setting.
Expand Down
1 change: 1 addition & 0 deletions lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"SettingDisablePasswordConfirmationHelp": "Einige administrative Aufgaben erfordern eine explizite Bestätigung des Benutzerpasswortes. Wenn Benutzer ohne gesetztes Passwort Matomo benutzen kann über diese Einstellung der Bestätigungsdialog überspringbar gemacht werden.",
"SettingDisableDirectLoginUrl": "Deaktiviere direkten Login Link",
"SettingDisableDirectLoginUrlHelp": "Wenn der Haken gesetzt ist muss der Login über die Login-Seite initiiert werden, anderenfalls lässt sich die Loginschaltfläche auch von dritten Seiten einbinden.",
"SettingHidePasswordLogin": "Wenn diese Option aktiviert ist, wird die Standard-Anmeldeaufforderung für Benutzername und Passwort ausgeblendet.",
"SettingAllowSignup": "Erstelle automatisch einen neuen Account, wenn sich ein unbekannter neuer Benutzer einloggt",
"SettingAllowSignupHelp": "",
"SettingAuthenticationName": "Name",
Expand Down
1 change: 1 addition & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"SettingDisablePasswordConfirmationHelp": "Certain administrational tasks require a password confirmation. When administrators are using this plugin and do not have a password they could confirm, this option can be used to skip the dialogue, when signed in via LoginOIDC",
"SettingDisableDirectLoginUrl": "Disable direct login url",
"SettingDisableDirectLoginUrlHelp": "When checked, users have to inititate the login via the Matomo login page. Otherwise the login button can be embedded in third-party services.",
"SettingHidePasswordLogin": "When checked, will hide standard username and password login prompt.",
"SettingAllowSignup": "Create new users when users try to log in with unknown OIDC accounts",
"SettingAllowSignupHelp": "",
"SettingBypassTwoFa": "Disable second factor when sign in with OIDC",
Expand Down
1 change: 1 addition & 0 deletions lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"SettingDisableSuperuserHelp": "",
"SettingDisableDirectLoginUrl": "Désactiver l'url de connexion directe",
"SettingDisableDirectLoginUrlHelp": "",
"SettingHidePasswordLogin": "Lorsque cette option est cochée, elle masque l'invite de connexion standard pour le nom d'utilisateur et le mot de passe.",
"SettingAllowSignup": "Créer une nouveau compte utilisateur quand les utilisateurs tentent de se connecter avec un compte OIDC inconnu",
"SettingAllowSignupHelp": "",
"SettingBypassTwoFa": "Désactiver le 2è facteur lors d'une connexion avec OIDC",
Expand Down
7 changes: 7 additions & 0 deletions stylesheets/loginModHidePwLogin.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.loginForm #login_form {
display: none;
}

.loginForm #nav {
display: none;
}