-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Redirect "Change Password" action to settings page
It works because the target URL will return a success code despite the ajax call. Then the ajax call of notifications app triggers the JS handler for "OCA.Notifications.Action" in which we can then actually redirect to the target URL.
- Loading branch information
Showing
4 changed files
with
62 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright (c) 2018 Vincent Petry <[email protected]> | ||
* | ||
* This file is licensed under the Affero General Public License version 3 | ||
* or later. | ||
* | ||
* See the COPYING-README file. | ||
* | ||
*/ | ||
(function () { | ||
|
||
$(document).ready(function() { | ||
// convert action URL to redirect | ||
$('body').on('OCA.Notification.Action', function(e) { | ||
if (e.notification.app === 'password_policy' | ||
&& (e.notification.object_type === 'about_to_expire' || e.notification.object_type === 'expired') | ||
&& e.action.type === 'GET' | ||
) { | ||
OC.redirect(e.notification.link); | ||
return false; | ||
} | ||
}); | ||
}); | ||
})(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters