Page MenuHomePhorge

D5787.1775204820.diff
No OneTemporary

Authored By
Unknown
Size
4 KB
Referenced Files
None
Subscribers
None

D5787.1775204820.diff

diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php
--- a/plugins/calendar/calendar.php
+++ b/plugins/calendar/calendar.php
@@ -3869,6 +3869,18 @@
$api = new calendar_nextcloud_api();
$name = (string) rcube_utils::get_input_value('_name', rcube_utils::INPUT_POST);
+ $pass = (string) rcube_utils::get_input_value('_pass', rcube_utils::INPUT_POST);
+
+ // When SSO is in use we do not have user password to use the Nextcloud API
+ // We have to ask the user to enter the password first.
+ if (!empty($_SESSION['oauth_token'])) {
+ if (!strlen($pass)) {
+ $this->rc->output->command('plugin.talk_room_create', true);
+ return;
+ }
+
+ $api->setPassword($pass);
+ }
$room_url = $api->talk_room_create($name);
@@ -3894,7 +3906,7 @@
$participants = [];
$organizer = null;
- // ollect participants' and organizer's email addresses
+ // Collect participants' and organizer's email addresses
foreach ($event['attendees'] as $attendee) {
if (!empty($attendee['email'])) {
if ($attendee['role'] == 'ORGANIZER') {
diff --git a/plugins/calendar/calendar_ui.js b/plugins/calendar/calendar_ui.js
--- a/plugins/calendar/calendar_ui.js
+++ b/plugins/calendar/calendar_ui.js
@@ -3539,11 +3539,21 @@
/*** Nextcloud Talk integration ***/
- this.talk_room_create = function()
+ this.talk_room_create = function(need_pass)
{
- var lock = rcmail.set_busy(true, 'calendar.talkroomcreating');
+ var func = function (pass) {
+ var lock = rcmail.set_busy(true, 'calendar.talkroomcreating');
+ rcmail.http_post('talk-room-create', { _name: $('#edit-title').val(), _pass: pass }, lock);
+ }
+
+ if (need_pass) {
+ var input = $('<input>').attr({ type: 'password', 'data-submit': 'true' });
+
+ rcmail.simple_dialog(input, 'calendar.talkroompassword', function () { func(input.val()); return true });
+ return
+ }
- rcmail.http_post('talk-room-create', { _name: $('#edit-title').val() }, lock);
+ func();
};
this.talk_room_created = function(data)
@@ -4230,6 +4240,7 @@
rcmail.addEventListener('plugin.close_history_dialog', function(data){ cal.close_history_dialog(); });
rcmail.addEventListener('plugin.event_show_revision', function(data){ cal.event_show_dialog(data, null, true); });
rcmail.addEventListener('plugin.itip_message_processed', function(data){ cal.itip_message_processed(data); });
+ rcmail.addEventListener('plugin.talk_room_create', function(data){ cal.talk_room_create(data); });
rcmail.addEventListener('plugin.talk_room_created', function(data){ cal.talk_room_created(data); });
rcmail.addEventListener('requestrefresh', function(q){ return cal.before_refresh(q); });
diff --git a/plugins/calendar/lib/calendar_nextcloud_api.php b/plugins/calendar/lib/calendar_nextcloud_api.php
--- a/plugins/calendar/lib/calendar_nextcloud_api.php
+++ b/plugins/calendar/lib/calendar_nextcloud_api.php
@@ -29,6 +29,7 @@
public const PARTICIPANT_PUBLIC = 5;
public const PARTICIPANT_GUEST_MODERATOR = 6;
+ protected $password = null;
/**
* Make a request to the Nextcloud API
@@ -53,7 +54,7 @@
// Authentication
$request->setAuth(
$rcmail->user->get_username(),
- $rcmail->decrypt($_SESSION['password'])
+ $this->password ?? $rcmail->decrypt($_SESSION['password'])
);
// Disable CSRF prevention, and enable JSON responses
@@ -211,4 +212,12 @@
return true;
}
+
+ /**
+ * Set password for API request
+ */
+ public function setPassword($password)
+ {
+ $this->password = $password;
+ }
}
diff --git a/plugins/calendar/localization/en_US.inc b/plugins/calendar/localization/en_US.inc
--- a/plugins/calendar/localization/en_US.inc
+++ b/plugins/calendar/localization/en_US.inc
@@ -326,4 +326,5 @@
$labels['createtalkroom'] = 'Create Talk room';
$labels['talkroomcreating'] = 'Creating a Talk room for the event...';
$labels['talkroomcreateerror'] = 'Failed to create a Talk room.';
+$labels['talkroompassword'] = 'Enter Nextcloud password';
$labels['talkroomname'] = 'Room for an event';

File Metadata

Mime Type
text/plain
Expires
Fri, Apr 3, 8:27 AM (9 h, 36 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18823234
Default Alt Text
D5787.1775204820.diff (4 KB)

Event Timeline