Compare commits
8
Commits
39daf5524c
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b926207927 | ||
|
|
f312f174ce | ||
|
|
cc618ecfda | ||
|
|
34d45c6338 | ||
|
|
872ebbd129 | ||
|
|
aef194c55d | ||
|
|
3aea64056b | ||
|
|
f39c5fcfe7 |
+1
-1
@@ -12,7 +12,7 @@
|
|||||||
<category>tools</category>
|
<category>tools</category>
|
||||||
<bugs>https://github.com/sashetov/ctautomailhooks</bugs>
|
<bugs>https://github.com/sashetov/ctautomailhooks</bugs>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<nextcloud min-version="15" max-version="25"/>
|
<nextcloud min-version="15" max-version="28"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<navigations>
|
<navigations>
|
||||||
</navigations>
|
</navigations>
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ class UserHooks {
|
|||||||
return function (\OC\User\User $user, string $password) {
|
return function (\OC\User\User $user, string $password) {
|
||||||
$email = $user->getUID() . $this->config->getEmailAddressSuffix();
|
$email = $user->getUID() . $this->config->getEmailAddressSuffix();
|
||||||
if($this->updateEmailPassword($email, $password)) {
|
if($this->updateEmailPassword($email, $password)) {
|
||||||
$this->logger->warning("Updated glesys password for account: " . $email, $this->logContext);
|
$this->logger->warning("updated email password for account" . $email, $this->logContext);
|
||||||
} else {
|
} else {
|
||||||
$this->logger->error("Error updating mail password for account" . $email);
|
$this->logger->error("Error updating mail password for account" . $email);
|
||||||
}
|
}
|
||||||
@@ -74,7 +74,7 @@ class UserHooks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function createEmailAccount($user_data) {
|
private function createEmailAccount($user_data) {
|
||||||
$ch = curl_init($this.config->getMailUAPI . 'user');
|
$ch = curl_init($this->config->getMailUAPI() . 'user');
|
||||||
$payload = json_encode($user_data);
|
$payload = json_encode($user_data);
|
||||||
curl_setopt($ch, CURLOPT_POST, 1);
|
curl_setopt($ch, CURLOPT_POST, 1);
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload );
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload );
|
||||||
@@ -99,8 +99,8 @@ class UserHooks {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function deleteEmailAccount($user_data) {
|
private function deleteEmailAccount($user) {
|
||||||
$ch = curl_init($this.config->getMailUAPI . 'user/' . urlencode($user_data->email));
|
$ch = curl_init($this->config->getMailUAPI() . 'user/' . urlencode($user));
|
||||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: ' . $this->config->getMailUKeys()));
|
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: ' . $this->config->getMailUKeys()));
|
||||||
|
|
||||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
|
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
|
||||||
@@ -124,9 +124,9 @@ class UserHooks {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function updateEmailPassword($user_data) {
|
private function updateEmailPassword($user, $password) {
|
||||||
$ch = curl_init($this.config->getMailUAPI . 'user/' . urlencode($user_data->email));
|
$ch = curl_init($this->config->getMailUAPI() . 'user/' . urlencode($user));
|
||||||
$payload = json_encode(array("raw_password" => $user_data['password']));
|
$payload = json_encode(array("raw_password" => $password));
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload );
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload );
|
||||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json',
|
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json',
|
||||||
'Authorization:' . $this->config->getMailUKeys()));
|
'Authorization:' . $this->config->getMailUKeys()));
|
||||||
|
|||||||
Reference in New Issue
Block a user