Skip to content

Commit

Permalink
Merge branch 'release/3.4.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
rhukster committed Jun 16, 2021
2 parents fbb181d + 31ab1cc commit 8c591fd
Show file tree
Hide file tree
Showing 51 changed files with 1,430 additions and 1,481 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# v3.4.4
## 06/16/2021

1. [](#new)
* Updated 2FA library
1. [](#bugfix)
* Fixed missing email conflict check when calling `Login::register()`

# v3.4.3
## 05/19/2021

Expand Down
2 changes: 1 addition & 1 deletion blueprints.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Login
slug: login
type: plugin
version: 3.4.3
version: 3.4.4
testing: false
description: Enables user authentication and login screen.
icon: sign-in
Expand Down
33 changes: 24 additions & 9 deletions classes/Login.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,40 +239,55 @@ public function authenticate($credentials, $options = ['remember_me' => true])
*/
public function register(array $data, array $files = [])
{
// Add defaults and mandatory fields.
$data += [
'username' => null,
'email' => null
];

if (!isset($data['groups'])) {
//Add new user ACL settings
$groups = (array) $this->config->get('plugins.login.user_registration.groups', []);

if (\count($groups) > 0) {
$data['groups'] = $groups;
}
}

if (!isset($data['access'])) {
$access = (array) $this->config->get('plugins.login.user_registration.access.site', []);

if (\count($access) > 0) {
$data['access']['site'] = $access;
}
}

// Validate fields from the form.
$username = $this->validateField('username', $data['username']);
$password = $this->validateField('password1', $data['password'] ?? $data['password1'] ?? null);
foreach ($data as $key => &$value) {
$value = $this->validateField($key, $value, $key === 'password2' ? $password : '');
}
unset($value);

/** @var UserCollectionInterface $users */
$users = $this->grav['accounts'];
/** @var UserCollectionInterface $accounts */
$accounts = $this->grav['accounts'];

// Check whether username already exists.
$username = $data['username'];
if (!$username || $accounts->find($username, ['username'])->exists()) {
/** @var Language $language */
$language = $this->grav['language'];

throw new \RuntimeException($language->translate(['PLUGIN_LOGIN.USERNAME_NOT_AVAILABLE', $username]));
}
// Check whether email already exists.
$email = $data['email'];
if (!$email || $accounts->find($email, ['email'])->exists()) {
/** @var Language $language */
$language = $this->grav['language'];

// Create user object and save it
$user = $users->load($username);
if ($user->exists()) {
throw new \RuntimeException('User ' . $username . ' cannot be registered: user already exists!');
throw new \RuntimeException($language->translate(['PLUGIN_LOGIN.EMAIL_NOT_AVAILABLE', $email]));
}

$user = $accounts->load($username);
$user->update($data, $files);
if (isset($data['groups'])) {
$user->groups = $data['groups'];
Expand Down
25 changes: 20 additions & 5 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions vendor/composer/InstalledVersions.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class InstalledVersions
'aliases' =>
array (
),
'reference' => '5670bd44d33b738ccf1baaf1615b42f7dbab78cb',
'reference' => 'b7996fda7a3b56432ef9e249584616d86d977517',
'name' => 'getgrav/grav-plugin-login',
),
'versions' =>
Expand Down Expand Up @@ -59,7 +59,7 @@ class InstalledVersions
'aliases' =>
array (
),
'reference' => '5670bd44d33b738ccf1baaf1615b42f7dbab78cb',
'reference' => 'b7996fda7a3b56432ef9e249584616d86d977517',
),
'paragonie/random_compat' =>
array (
Expand All @@ -72,12 +72,12 @@ class InstalledVersions
),
'robthree/twofactorauth' =>
array (
'pretty_version' => '1.7.0',
'version' => '1.7.0.0',
'pretty_version' => '1.8.0',
'version' => '1.8.0.0',
'aliases' =>
array (
),
'reference' => '37983bf675c5baca09d19d6705170489d0df0002',
'reference' => '30a38627ae1e7c9399dae67e265063cd6ec5276c',
),
),
);
Expand Down
33 changes: 26 additions & 7 deletions vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,26 +150,31 @@
},
{
"name": "robthree/twofactorauth",
"version": "1.7.0",
"version_normalized": "1.7.0.0",
"version": "1.8.0",
"version_normalized": "1.8.0.0",
"source": {
"type": "git",
"url": "https://github.com/RobThree/TwoFactorAuth.git",
"reference": "37983bf675c5baca09d19d6705170489d0df0002"
"reference": "30a38627ae1e7c9399dae67e265063cd6ec5276c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/RobThree/TwoFactorAuth/zipball/37983bf675c5baca09d19d6705170489d0df0002",
"reference": "37983bf675c5baca09d19d6705170489d0df0002",
"url": "https://api.github.com/repos/RobThree/TwoFactorAuth/zipball/30a38627ae1e7c9399dae67e265063cd6ec5276c",
"reference": "30a38627ae1e7c9399dae67e265063cd6ec5276c",
"shasum": ""
},
"require": {
"php": ">=5.6.0"
},
"require-dev": {
"php-parallel-lint/php-parallel-lint": "^1.2",
"phpunit/phpunit": "@stable"
},
"time": "2020-01-02T19:56:46+00:00",
"suggest": {
"bacon/bacon-qr-code": "Needed for BaconQrCodeProvider provider",
"endroid/qr-code": "Needed for EndroidQrCodeProvider"
},
"time": "2021-03-09T18:24:05+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
Expand Down Expand Up @@ -200,9 +205,23 @@
"php",
"tfa"
],
"support": {
"issues": "https://github.com/RobThree/TwoFactorAuth/issues",
"source": "https://github.com/RobThree/TwoFactorAuth"
},
"funding": [
{
"url": "https://paypal.me/robiii",
"type": "custom"
},
{
"url": "https://github.com/RobThree",
"type": "github"
}
],
"install-path": "../robthree/twofactorauth"
}
],
"dev": true,
"dev": false,
"dev-package-names": []
}
10 changes: 5 additions & 5 deletions vendor/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
'aliases' =>
array (
),
'reference' => '5670bd44d33b738ccf1baaf1615b42f7dbab78cb',
'reference' => 'b7996fda7a3b56432ef9e249584616d86d977517',
'name' => 'getgrav/grav-plugin-login',
),
'versions' =>
Expand Down Expand Up @@ -36,7 +36,7 @@
'aliases' =>
array (
),
'reference' => '5670bd44d33b738ccf1baaf1615b42f7dbab78cb',
'reference' => 'b7996fda7a3b56432ef9e249584616d86d977517',
),
'paragonie/random_compat' =>
array (
Expand All @@ -49,12 +49,12 @@
),
'robthree/twofactorauth' =>
array (
'pretty_version' => '1.7.0',
'version' => '1.7.0.0',
'pretty_version' => '1.8.0',
'version' => '1.8.0.0',
'aliases' =>
array (
),
'reference' => '37983bf675c5baca09d19d6705170489d0df0002',
'reference' => '30a38627ae1e7c9399dae67e265063cd6ec5276c',
),
),
);
4 changes: 4 additions & 0 deletions vendor/robthree/twofactorauth/.github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# These are supported funding model platforms

github: [RobThree]
custom: ["https://paypal.me/robiii"]
27 changes: 27 additions & 0 deletions vendor/robthree/twofactorauth/.github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Test

on:
push:
pull_request:

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
php-version: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']

steps:
- uses: actions/checkout@v2

- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: composer
coverage: xdebug

- uses: ramsey/composer-install@v1

- run: composer lint
- run: composer test
7 changes: 5 additions & 2 deletions vendor/robthree/twofactorauth/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
Expand Down Expand Up @@ -184,6 +184,9 @@ FakesAssemblies/

# Composer
/vendor
composer.lock

# .vs
.vs/
.vs/

.phpunit.result.cache
15 changes: 0 additions & 15 deletions vendor/robthree/twofactorauth/.travis.yml

This file was deleted.

Loading

0 comments on commit 8c591fd

Please sign in to comment.