From fffb6278444e97b087955e903128a21701bc3b31 Mon Sep 17 00:00:00 2001
From: Joas Schilling
- t('Enter a semicolon-separated list of allowed domains, * for wildcard. Example: %s', ['nextcloud.com;*.example.com']));?> + > +
- >
From 2438813f1711fe69762d69c0774f74fae9c07049 Mon Sep 17 00:00:00 2001 From: Joas Schilling> + echo ' checked'; +} ?>>
> + echo ' checked'; +} ?>>
From 9bdf377aecc7ea1e11d60451e9d2c5a4a89157eb Mon Sep 17 00:00:00 2001 From: Joas Schilling+ > + +
+ ++ > + +
config->expects($this->once())
+ public function testValidateEmail(string $email, string $allowedDomains, string $blocked) {
+ $this->config->expects($this->atLeastOnce())
->method('getAppValue')
- ->with('registration', 'allowed_domains', '')
- ->willReturn($allowedDomains);
+ ->willReturnMap([
+ ['registration', 'allowed_domains', '', $allowedDomains],
+ ['registration', 'domains_is_blocklist', 'no', $blocked],
+ ['registration', 'show_domains', 'no', 'no'],
+ ]);
$this->service->validateEmail($email);
}
- public function testValidateNewEmailNotWithinAllowedDomain() {
- $email2 = 'bbbb@gmail.com';
+ public function dataValidateEmailThrows(): array {
+ return [
+ ['aaaa@example.com', 'nextcloud.com;example.tld', 'no'],
+ ['aaaa@example.com', 'nextcloud.com', 'no'],
- $this->config->expects($this->atLeastOnce())
- ->method('getAppValue')
- ->with('registration', 'allowed_domains', '')
- ->willReturn('example.com');
-
- $this->expectException(RegistrationException::class);
- $this->service->validateEmail($email2);
- }
-
- public function testValidateNewEmailWithinMultipleAllowedDomain() {
- $email = 'aaaa@example.com';
- $email2 = 'bbbb@gmail.com';
-
- $this->config->expects($this->atLeastOnce())
- ->method('getAppValue')
- ->with('registration', 'allowed_domains', '')
- ->willReturn('example.com;gmail.com');
-
- $this->service->validateEmail($email);
- $this->service->validateEmail($email2);
+ ['aaaa@example.com', 'example.com', 'yes'],
+ ['aaaa@example.com', 'eXample.com', 'yes'],
+ ['aaaa@eXample.com', 'example.com', 'yes'],
+ ['aaaa@example.com', 'example.com;example.tld', 'yes'],
+ ['aaaa@example.com', 'example.tld;example.com', 'yes'],
+ ['aaaa@cloud.example.com', '*.example.com', 'yes'],
+ ['aaaa@cloud.example.com', 'cloud.example.*', 'yes'],
+ ];
}
/**
- * @depends testValidateNewEmailWithinMultipleAllowedDomain
+ * @dataProvider dataValidateEmailThrows
+ * @param string $email
+ * @param string $allowedDomains
+ * @param string $blocked
+ * @throws RegistrationException
*/
- public function testValidateNewEmailNotWithinMultipleAllowedDomain() {
- $email2 = 'cccc@yahoo.com';
-
+ public function testValidateEmailThrows(string $email, string $allowedDomains, string $blocked) {
$this->config->expects($this->atLeastOnce())
->method('getAppValue')
- ->with('registration', 'allowed_domains', '')
- ->willReturn('example.com;gmail.com');
+ ->willReturnMap([
+ ['registration', 'allowed_domains', '', $allowedDomains],
+ ['registration', 'domains_is_blocklist', 'no', $blocked],
+ ['registration', 'show_domains', 'no', 'no'],
+ ]);
$this->expectException(RegistrationException::class);
- $this->service->validateEmail($email2);
+ $this->service->validateEmail($email);
}
public function testCreatePendingReg() {
From b6a8a5b3713845c28b765c32decaf17930df3263 Mon Sep 17 00:00:00 2001
From: Joas Schilling z?jTRJ?nYBZn5JpU-whsT0dO^}XHy2CFLq8^0VU4l9o6Hq`1>g%=y_k>j78VB
zH`~u;clIXPZ{|1kEab@aS;hui@amDKJeAfXSYX?iAB@4}GVby%w!Y3$9B+8fH_^o<
z-IBd+;n2+`Js#Y-kdMFtz;=xW|0N!k6H)Kl?!9=E_ic^M((qx%Z-=Ht1sy+9g>@W8
zey^d$iN09RAkZ}JFMInfn=G2Qb@M(?Oc8;k0#Q3_&v#?Ep@eHXI5lW5D}!QMGaxrj
z6`{GmWOyA>G>9p>=ZEOt|8!q(=PNMqv2wcclx!A`S&N&g#A%nEXeH*P8%l3GRkuHR
z?N2F6Zcdh6!~@_3kP-nu#SH5;KmKpFc@Ee$6XhICE&LNBLBbw~f6v440F74`MIELf
zy%TxLq?XE*cw@u ?|m1MDPQ<{`|ZwdO;x?YQMiO$_5~U~VS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