Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
f458d4222c | |||
a25165b36f | |||
181e3a2ae9 | |||
9e2852a8e0 | |||
e08392ae27 | |||
9c0a46a69b | |||
9afca45377 | |||
b7f6d20259 | |||
b1b2c68f93 |
17
.github/workflows/main.yml
vendored
Normal file
17
.github/workflows/main.yml
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
name: Workflow
|
||||||
|
|
||||||
|
on: [push]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
mirror:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- uses: yesolutions/mirror-action@master
|
||||||
|
with:
|
||||||
|
REMOTE: 'https://git.popov.link/moodle/auth_link.git'
|
||||||
|
GIT_USERNAME: ${{ secrets.GIT_USERNAME }}
|
||||||
|
GIT_PASSWORD: ${{ secrets.GIT_PASSWORD }}
|
19
README.md
19
README.md
@ -7,9 +7,8 @@
|
|||||||
Authorization plugin for Moodle.
|
Authorization plugin for Moodle.
|
||||||
Adds the ability to authorize a user by a direct link.
|
Adds the ability to authorize a user by a direct link.
|
||||||
|
|
||||||
<a name="installation">
|
## Installation
|
||||||
<h2>Installation</h2>
|
|
||||||
</a>
|
|
||||||
Get the installation package in any of the available methods:
|
Get the installation package in any of the available methods:
|
||||||
|
|
||||||
* [GitHub Releases](https://github.com/valentineus/auth-link/releases).
|
* [GitHub Releases](https://github.com/valentineus/auth-link/releases).
|
||||||
@ -17,9 +16,8 @@ Get the installation package in any of the available methods:
|
|||||||
|
|
||||||
In Moodle in the administration panel go to the "Plugins" section and make a standard installation of the plug-in.
|
In Moodle in the administration panel go to the "Plugins" section and make a standard installation of the plug-in.
|
||||||
|
|
||||||
<a name="using">
|
## Using
|
||||||
<h2>Using</h2>
|
|
||||||
</a>
|
|
||||||
Pass the variables `username` and `password` in any standard way.
|
Pass the variables `username` and `password` in any standard way.
|
||||||
Variables are read from a file `$ _REQUEST`, which guarantees GET and POST requests performance, as well as support for the cookie.
|
Variables are read from a file `$ _REQUEST`, which guarantees GET and POST requests performance, as well as support for the cookie.
|
||||||
|
|
||||||
@ -28,9 +26,8 @@ Example of a link that authorizes a user on the course:
|
|||||||
https://yourwebserver.org/course/view.php?id=2&username=guest&password=qwerty
|
https://yourwebserver.org/course/view.php?id=2&username=guest&password=qwerty
|
||||||
```
|
```
|
||||||
|
|
||||||
<a name="build">
|
## Build
|
||||||
<h2>Build</h2>
|
|
||||||
</a>
|
|
||||||
Self-assembly package is as follows:
|
Self-assembly package is as follows:
|
||||||
|
|
||||||
* Clone the repository:
|
* Clone the repository:
|
||||||
@ -44,9 +41,7 @@ cd ./auth-link
|
|||||||
/bin/sh build.sh
|
/bin/sh build.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
<a name="license">
|
## License
|
||||||
<h2>License</h2>
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<img height="256px" alt="GNU Banner" src="https://www.gnu.org/graphics/runfreegnu.png" />
|
<img height="256px" alt="GNU Banner" src="https://www.gnu.org/graphics/runfreegnu.png" />
|
||||||
|
|
||||||
|
21
auth.php
21
auth.php
@ -67,7 +67,7 @@ class auth_plugin_link extends auth_plugin_base {
|
|||||||
/**
|
/**
|
||||||
* No password updates.
|
* No password updates.
|
||||||
*/
|
*/
|
||||||
public function user_update_password() {
|
public function user_update_password($user, $newpassword) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,13 +127,11 @@ class auth_plugin_link extends auth_plugin_base {
|
|||||||
public function loginpage_hook() {
|
public function loginpage_hook() {
|
||||||
global $DB;
|
global $DB;
|
||||||
|
|
||||||
|
$username = optional_param('username', '', PARAM_RAW);
|
||||||
|
$password = optional_param('password', '', PARAM_RAW);
|
||||||
|
|
||||||
if (!isloggedin()) {
|
if (!isloggedin()) {
|
||||||
if (isset($_REQUEST['username']) &&
|
if (!empty($username) && !empty($password)) {
|
||||||
isset($_REQUEST['password'])) {
|
|
||||||
|
|
||||||
$username = htmlspecialchars($_REQUEST['username']);
|
|
||||||
$password = htmlspecialchars($_REQUEST['password']);
|
|
||||||
|
|
||||||
// User existence check.
|
// User existence check.
|
||||||
if ($user = $DB->get_record('user', array('username' => $username) )) {
|
if ($user = $DB->get_record('user', array('username' => $username) )) {
|
||||||
// Verification of authorization data.
|
// Verification of authorization data.
|
||||||
@ -152,12 +150,13 @@ class auth_plugin_link extends auth_plugin_base {
|
|||||||
public function redirect_user() {
|
public function redirect_user() {
|
||||||
global $CFG, $SESSION;
|
global $CFG, $SESSION;
|
||||||
|
|
||||||
$redirect = $CFG->wwwroot;
|
$wantsurl = optional_param('wantsurl', '', PARAM_URL);
|
||||||
|
$redirect = new moodle_url($CFG->wwwroot, $_GET);
|
||||||
|
|
||||||
if (isset($SESSION->wantsurl)) {
|
if (isset($SESSION->wantsurl)) {
|
||||||
$redirect = $SESSION->wantsurl;
|
$redirect = new moodle_url($SESSION->wantsurl, $_GET);
|
||||||
} else if (isset($_GET['wantsurl'])) {
|
} else if (!empty($wantsurl)) {
|
||||||
$redirect = htmlspecialchars($_GET['wantsurl']);
|
$redirect = new moodle_url($wantsurl);
|
||||||
}
|
}
|
||||||
|
|
||||||
redirect($redirect);
|
redirect($redirect);
|
||||||
|
1
build.sh
1
build.sh
@ -11,6 +11,7 @@ export PATH="$PATH:/usr/local/scripts"
|
|||||||
|
|
||||||
# Build the package
|
# Build the package
|
||||||
cd ..
|
cd ..
|
||||||
|
mv "./moodle_auth-link" "./auth-link"
|
||||||
zip -9 -r "auth-link.zip" "auth-link" \
|
zip -9 -r "auth-link.zip" "auth-link" \
|
||||||
-x "auth-link/.git*" \
|
-x "auth-link/.git*" \
|
||||||
-x "auth-link/.travis.yml" \
|
-x "auth-link/.travis.yml" \
|
||||||
|
@ -23,8 +23,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
defined('MOODLE_INTERNAL') || die();
|
defined('MOODLE_INTERNAL') || die();
|
||||||
$plugin->release = '1.0.0 (Build: 2017101701)';
|
$plugin->release = '1.1.1 (Build: 2018061010)';
|
||||||
$plugin->version = 2017101701;
|
$plugin->version = 2018061010;
|
||||||
$plugin->requires = 2016112900;
|
$plugin->requires = 2016112900;
|
||||||
$plugin->component = 'auth_link';
|
$plugin->component = 'auth_link';
|
||||||
$plugin->maturity = MATURITY_STABLE;
|
$plugin->maturity = MATURITY_STABLE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user