-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from catalyst/logout
Implement logout functionality
- Loading branch information
Showing
6 changed files
with
138 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,18 +82,29 @@ get an error. | |
If this setting is set to yes, then your web application has to provie user's ip address to generate a user key. Then | ||
the user should have provided ip when using this key. If ip address is different a user will get an error. | ||
|
||
**Logout redirect URL** | ||
**Redirect after logout from Moodle** | ||
|
||
You can set URL to redirect users after they logged out from Moodle. For example you can redirect them | ||
to logout script of your web application to log users out from it as well. This setting is optional. | ||
|
||
|
||
**URL of SSO host** | ||
|
||
You can set URL to redirect users before they see Moodle login page. For example you can redirect them | ||
to your web application to login page. You can use "enrolkey_skipsso" URL parameter to bypass this option. | ||
E.g. http://yourmoodle.com/login/index.php?enrolkey_skipsso=1 | ||
|
||
**Logout URL** | ||
|
||
If you need to logout users after they logged out from the external application, you can redirect them | ||
to logout script with required parameter "return". | ||
|
||
E.g. http://yourmoodle.com/auth/userkey/logout.php?return=www.google.com | ||
|
||
|
||
Users will be logged out from Moodle and then redirected to the provided URL. | ||
In case when a user session is already expired, the user will be still redirected. | ||
|
||
|
||
**Example client** | ||
|
||
**Note:** the code below is not for production use. It's just a quick and dirty way to test the functionality. | ||
|
@@ -161,10 +172,6 @@ function getloginurl($useremail, $firstname, $lastname, $username, $courseid = n | |
echo getloginurl('[email protected]', 'barry', 'white', 'barrywhite', 2, 'certificate', 8); | ||
``` | ||
|
||
TODO: | ||
----- | ||
1. Implement logout webservice to be able to call it from external application. | ||
|
||
|
||
# Crafted by Catalyst IT | ||
|
||
|
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
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,31 @@ | ||
<?php | ||
// This file is part of Moodle - http://moodle.org/ | ||
// | ||
// Moodle is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// Moodle is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* Logout page for auth_userkey. | ||
* | ||
* @package auth_userkey | ||
* @copyright 2016 Dmitrii Metelkin ([email protected]) | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
require_once(dirname(__FILE__) . '/../../config.php'); | ||
|
||
if (!is_enabled_auth('userkey')) { | ||
print_error(get_string('pluginisdisabled', 'auth_userkey')); | ||
} | ||
|
||
get_auth_plugin('userkey')->user_logout_userkey(); |
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