Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
243 commits
Select commit Hold shift + click to select a range
381e76d
Add to migrations and update docs
evansharp Feb 24, 2025
3e27b27
PR updates based on conversations
evansharp Feb 26, 2025
84212de
Coderabbit is kid of annoying eh?
evansharp Feb 26, 2025
239a494
fix property name to address #177
evansharp Apr 12, 2025
11ef538
fix: require for shield V
datamweb Oct 26, 2022
dbf8c9b
fix: demo name for `src`
datamweb Oct 26, 2022
810d761
docs: fix filter except list
datamweb Nov 2, 2022
39a1b09
fix: add lang file name for unknown error for translation
datamweb Nov 2, 2022
be9266d
github: add issue tpl
datamweb Nov 3, 2022
11783fd
fix: shield version
datamweb Nov 3, 2022
4f5e4b6
refactor: fix foreach argument whit array type
datamweb Nov 3, 2022
3dba4de
fix: allOAuth to `allOAuth()`
datamweb Nov 3, 2022
343d327
composer: update for add `cs-fixer`
datamweb Nov 5, 2022
1409d02
chore: add `cs-fixer` via CI `devkit`
datamweb Nov 5, 2022
35ce784
composer: update for allow install `phpstan`
datamweb Nov 6, 2022
bf5afd1
GA: add phpcsfixer
datamweb Nov 6, 2022
8c9c8e1
GA: add phpcpd action
datamweb Nov 6, 2022
2902e61
chore: add action icone to docs
datamweb Nov 6, 2022
c18d5a7
style: run cs-fix for `src/`
datamweb Nov 6, 2022
bac91a9
fix: typo
enderlinp Nov 9, 2022
09e058f
chore: update minimum CI4 version to 4.2.7 @see `shield/pull/517`
datamweb Nov 12, 2022
0bf72aa
chore: add `curl` to require list
datamweb Nov 27, 2022
b3ae400
chore: add dependabot action
datamweb Nov 29, 2022
3da36fb
docs: add note for `php spark make:oauthconfig`
datamweb Dec 2, 2022
920e4a9
feat: add new CLI command `make:oauthconfig`
datamweb Dec 2, 2022
2296095
style: run cs-fix
datamweb Dec 2, 2022
481e3aa
Create french ShieldOAuthLang file
l-vanel Jan 15, 2023
8d0e99a
Update ShieldOAuthLang.php
l-vanel Jan 15, 2023
09456ce
style: run cs-fix for fix style code
datamweb Jan 15, 2023
2ff4a33
docs: fix typo
datamweb Feb 9, 2023
9202147
refactor: remove namespace from lang file
datamweb Feb 9, 2023
5fcb073
chore: replace deprecated COMPOSER_TOKEN with GITHUB_TOKEN
datamweb Feb 9, 2023
4037ce2
Added parent::initialize() in ShieldOAuthModel.php
AlbertoMoricca Mar 15, 2023
f7750ee
Changed GET to POST in fetchUserInfoWithToken() method in GoogleOAuth…
AlbertoMoricca Mar 15, 2023
ab686bc
chore: delete demo file for reduce the size of the package.
datamweb Mar 29, 2023
0125129
create command generator file
sammyskills Apr 3, 2023
ff132d6
applied suggestions from code review, cs-fix
sammyskills Apr 3, 2023
871e89f
fixed typo: callbake_url to callback_url
sammyskills Apr 3, 2023
22d2de9
declare variables before using them in class methods
sammyskills Apr 3, 2023
477c306
use exception
sammyskills Apr 3, 2023
0f56350
add use exception to doc
sammyskills Apr 3, 2023
91e8034
create the base template for the new OAuth generation
sammyskills Apr 4, 2023
bb4a6b2
applied code review suggestion
sammyskills Apr 4, 2023
f9e4d6c
applied code review suggestion
sammyskills Apr 4, 2023
1090536
automatically update config file
sammyskills Apr 4, 2023
ed9a857
prevent creation of new OAuth if ShieldOAuthConfig.php is missing
sammyskills Apr 4, 2023
49b68a7
applied code review suggestion
sammyskills Apr 5, 2023
2e351fa
generate default language file
sammyskills Apr 5, 2023
462fad2
added docs
sammyskills Apr 5, 2023
c58098f
fix: replace "Github" with "GitHub"
kenjis Aug 23, 2023
af2d04f
style: composer cs-fix
kenjis Aug 23, 2023
ba899f2
docs: fix phpstan error from `Config/ShieldOAuthConfig.php`
datamweb Nov 10, 2022
54afc6b
docs: fix phpstan error from `Config/Registrar.php`
datamweb Nov 10, 2022
a2328bd
docs: fix phpstan error from `Config/Services.php`
datamweb Nov 11, 2022
26f6d55
fix: update for use `list`
datamweb Nov 11, 2022
b5d8a70
docs: fix phpstan error from `Config/Routes.php`
datamweb Nov 13, 2022
77394ba
docs: fix phpstan error from `Models/ShieldOAuthModel.php`
datamweb Nov 13, 2022
e24a816
docs: fix phpstan error from `Migrations\2022-10-20-182737_ShieldOAut…
datamweb Nov 13, 2022
7de06d5
docs: fix phpstan error from `Basic/ControllersInterface.php`
datamweb Nov 14, 2022
9edfc4f
docs: fix phpstan error from `Basic/ShieldOAuth.php`
datamweb Nov 14, 2022
ec6e818
refactor: fix file path
kenjis Aug 23, 2023
c7bdf04
fix: add missing return types
kenjis Aug 23, 2023
3a28fa8
chore: add phpstan.neon.dist
kenjis Aug 23, 2023
87a8eaf
chore: add baseline for PHPStan
kenjis Aug 23, 2023
7644dcf
refactor: add missing return type
kenjis Aug 23, 2023
db9400c
fix: import undefined LoginModel
kenjis Aug 23, 2023
1c880ed
refactor: add missing return type
kenjis Aug 23, 2023
5ea765f
docs: fix comments
kenjis Aug 23, 2023
cdb627e
docs: replace Github with GitHub
kenjis Aug 24, 2023
fbb05f8
docs: add empty lines
kenjis Aug 24, 2023
e489ac2
docs: align `=>`
kenjis Aug 24, 2023
b947406
docs: replace \ with /
kenjis Aug 24, 2023
7ff0b7d
docs: add indent
kenjis Aug 24, 2023
6377ae4
docs: fix headings
kenjis Aug 24, 2023
4901347
chore: composer require --dev rector/rector
kenjis Aug 24, 2023
2495969
chore: add config file for rector from devkit
kenjis Aug 24, 2023
66a9fe7
chore: update .php-cs-fixer.dist.php for rector
kenjis Aug 24, 2023
3912bce
refactor: run rector
kenjis Aug 24, 2023
59c09e0
fix: remove property types because parent classes do not define
kenjis Aug 24, 2023
5fe2f72
chore: remove ignore errors for PHPStan
kenjis Aug 24, 2023
1ea9c7f
chore: add github action for rector
datamweb Aug 26, 2023
55fd0c0
chore: add github action for phpstan
datamweb Aug 26, 2023
857b013
chore: fix rector error
datamweb Aug 27, 2023
484d1dd
chore: fix rector error
datamweb Aug 27, 2023
d5565f7
chore: fix phpstan error
datamweb Aug 27, 2023
cdd03cc
chore: fix error
datamweb Aug 27, 2023
6142295
chore: fix phpstan error
datamweb Aug 27, 2023
c500eb0
fix: resolve call to protected method OAuthController
datamweb Aug 27, 2023
0be3526
docs: add status badge rector/phpstan
datamweb Aug 27, 2023
2314a9b
docs: add status badge rector/phpstan for index.md
datamweb Aug 27, 2023
3bc038e
Update composer.json
webalchemist May 5, 2023
d9ffdb1
Chore: remove `^` for rector ver
datamweb Aug 29, 2023
d6f4cc0
chore(deps-dev): update rector/rector requirement from 0.18.0 to 0.18.1
dependabot[bot] Aug 29, 2023
d3d41ef
chore: update dependabot
datamweb Aug 29, 2023
edd5986
chore(deps): bump actions/checkout from 3 to 4
dependabot[bot] Sep 5, 2023
20f8d99
chore(deps-dev): update rector/rector requirement from 0.18.1 to 0.18.2
dependabot[bot] Sep 7, 2023
ad9c657
Update 'username' field for 'newUser' process
clsmedia Sep 7, 2023
99406a7
chore: update phpstan.neon.dist
datamweb Sep 12, 2023
6b74f5f
Rename LICENSE.md to LICENSE
datamweb Sep 12, 2023
d1503cb
Update README.md
datamweb Sep 12, 2023
a9d8912
chore(deps-dev): update rector/rector requirement from 0.18.2 to 0.18.3
dependabot[bot] Sep 13, 2023
b1e4c56
docs: update for use `develop` branch
datamweb Sep 13, 2023
6abb16d
docs: update use `develop` branch
datamweb Sep 13, 2023
c530bbb
docs: fix Cross-Origin
datamweb Sep 22, 2023
56fd67e
docs: fix Cross-Origin
datamweb Sep 22, 2023
ee53c53
docs: fix logo
datamweb Sep 22, 2023
a0cdead
chore: add docs.yml
datamweb Sep 22, 2023
15877da
Create mkdocs.yml
datamweb Sep 22, 2023
bf419a6
docs: add site url
datamweb Sep 22, 2023
e1ce1d8
Update mkdocs.yml
datamweb Sep 22, 2023
1d82d97
Update mkdocs.yml
datamweb Sep 22, 2023
2e8bf7d
Update docs.yml
datamweb Sep 22, 2023
b7be9cd
Update docs.yml
datamweb Sep 22, 2023
8b6b297
Update get_keys.md
datamweb Sep 22, 2023
ee0dfc8
chore: add site url
datamweb Sep 22, 2023
799a38e
chore: fix url
datamweb Sep 22, 2023
ab23142
Add files via upload
datamweb Sep 22, 2023
2254566
docs: fix space in command
datamweb Sep 22, 2023
f788e8b
chore(deps-dev): update rector/rector requirement from 0.18.3 to 0.18.4
dependabot[bot] Sep 26, 2023
2d2d18f
chore(deps-dev): update rector/rector requirement from 0.18.4 to 0.18.5
dependabot[bot] Oct 6, 2023
c54cd5d
Update docs.yml
datamweb Oct 17, 2023
ae22388
add `site` for mkdocs
datamweb Oct 26, 2023
e103eff
chore(deps-dev): update rector/rector requirement from 0.18.5 to 0.18.6
dependabot[bot] Oct 25, 2023
43eaf01
phpstan: fix phpstan errores
datamweb Oct 26, 2023
cd6b0c8
req CI4.3.5
datamweb Oct 26, 2023
0692f77
req CI 4.3.5
datamweb Oct 26, 2023
09ea9f0
chore(deps-dev): update rector/rector requirement from 0.18.6 to 0.18.7
dependabot[bot] Nov 14, 2023
c438855
chore(deps-dev): update rector/rector requirement from 0.18.7 to 0.18.8
dependabot[bot] Nov 14, 2023
1178841
chore(deps-dev): update rector/rector requirement from 0.18.8 to 0.18.10
dependabot[bot] Nov 17, 2023
a87f9a6
chore(deps-dev): update rector/rector requirement
dependabot[bot] Nov 28, 2023
556fb8b
chore(deps-dev): update rector/rector requirement
dependabot[bot] Dec 4, 2023
05c5e5f
chore(deps): bump actions/setup-python from 4 to 5
dependabot[bot] Dec 7, 2023
dd64392
chore(deps-dev): update rector/rector requirement
dependabot[bot] Dec 21, 2023
7d636f1
Update composer.json to use v1.0.0
jozefrebjak Jan 1, 2024
6b43c09
Update composer.json
jozefrebjak Jan 1, 2024
be2a457
Update composer.json
jozefrebjak Jan 1, 2024
d963bc2
Update composer.json
datamweb Jan 1, 2024
9577d27
chore(deps): bump actions/cache from 3 to 4
dependabot[bot] Jan 18, 2024
56406ee
chore(deps-dev): update rector/rector requirement from 0.18.13 to 0.19.5
dependabot[bot] Jan 30, 2024
477a963
chore(deps-dev): update rector/rector requirement from 0.19.5 to 0.19.7
dependabot[bot] Feb 4, 2024
097616c
chore(deps-dev): update rector/rector requirement from 0.19.7 to 0.19.8
dependabot[bot] Feb 5, 2024
43b7422
chore: update rector ver
datamweb Feb 5, 2024
282cf29
fix: use new namespace for rector
datamweb Feb 5, 2024
1f7449c
style: fix code style error
datamweb Feb 5, 2024
1e18f69
chore: use ver 1.0.0 of rector
datamweb Feb 7, 2024
450f55e
chore: use ver 1.0.0 of rector
datamweb Feb 7, 2024
76e5668
chore(deps-dev): update rector/rector requirement from 1.0.0 to 1.0.1
dependabot[bot] Feb 19, 2024
cfb6421
docs: update phpdocs
datamweb Feb 19, 2024
7bade19
chore: update phpstan-baseline
datamweb Feb 19, 2024
40f3fad
feat: add used env config for keys
datamweb Feb 27, 2024
24394d2
docs: add env for set yahoo keys
datamweb Feb 27, 2024
3a92bde
docs: add how set keys via `.env`
datamweb Feb 27, 2024
4d4a89a
chore(deps-dev): update rector/rector requirement from 1.0.1 to 1.0.2
dependabot[bot] Mar 4, 2024
465b2a3
chore(deps-dev): update rector/rector requirement from 1.0.2 to 1.0.3
dependabot[bot] Mar 15, 2024
d882d55
chore(deps-dev): update rector/rector requirement from 1.0.3 to 1.0.4
dependabot[bot] Apr 8, 2024
8545251
feat: use config file in the custom namespace
datamweb Apr 11, 2024
80f420b
style: fix code style
datamweb Apr 11, 2024
bf6ea06
docs: improve docs for yahoo driver
datamweb Apr 11, 2024
fb0b8f0
chore(deps-dev): update rector/rector requirement from 1.0.4 to 1.0.5
dependabot[bot] May 13, 2024
78c907a
fix: [BUG] Undefined property: stdClass::$family_name
warcooft May 16, 2024
1e68f2c
feat: add 'allow_register' to $oauthConfigs for oauth drivers
warcooft May 16, 2024
0468195
fix: Undefined property: stdClass::$family_name when register a new user
warcooft May 17, 2024
32df3dd
lang: [id] Added support language Indonesian
warcooft May 17, 2024
aac734c
chore: add no merge commites check
datamweb May 18, 2024
b331019
chore(deps-dev): update rector/rector requirement from 1.0.5 to 1.1.0…
dependabot[bot] May 18, 2024
c95c0dd
chore(deps-dev): update rector/rector requirement from 1.1.0 to 1.1.1
dependabot[bot] Jun 24, 2024
df7cf20
chore(deps): bump NexusPHP/no-merge-commits from 2.0.0 to 2.1.0
dependabot[bot] Jun 25, 2024
1a53562
chore(deps-dev): update rector/rector requirement from 1.1.1 to 1.2.0
dependabot[bot] Jul 2, 2024
cdac02b
chore(deps-dev): update rector/rector requirement from 1.2.0 to 1.2.1
dependabot[bot] Jul 16, 2024
a33293a
use instantiation
warcooft Jul 20, 2024
82d7d60
ignore PHP 8.1 Coding Standards check
warcooft Jul 20, 2024
11fc0d6
set modernize_strpos to false for php7.4 compatibility
warcooft Jul 21, 2024
890249f
chore(deps-dev): update rector/rector requirement from 1.2.1 to 1.2.2
dependabot[bot] Jul 26, 2024
f2de9ac
Fix; Dig deeper for email addresses on Github
Zoly Jul 22, 2024
a39d3ba
add email placeholder to 'Callback.account_not_found' lang key
warcooft Jul 28, 2024
f923881
fix error
warcooft Jul 28, 2024
1c7b228
apply commit suggestion
warcooft Jul 28, 2024
6ba68d9
handles deauthentication actions by users
warcooft Jul 28, 2024
6dc7adc
rm white space
warcooft Jul 28, 2024
5d8aac6
add message placeholder
warcooft Jul 29, 2024
b1fcd44
update placeholder
warcooft Jul 29, 2024
06ff5c2
use ucfirst()
warcooft Jul 29, 2024
7ff3e83
update
warcooft Jul 29, 2024
bc9b830
update persian lang.
warcooft Jul 29, 2024
54e9d02
update french lang
warcooft Jul 29, 2024
eebf936
docs: update mkdocs copyright
datamweb Jul 31, 2024
3962e6a
docs: update LICENSE copyright year
datamweb Jul 31, 2024
c84ddeb
chore: add auto-update-copyright-year github action
datamweb Jul 31, 2024
f9cce8b
fix: use lables with comma
datamweb Jul 31, 2024
9d5cb79
fix: update auto-update-copyright.yml
datamweb Jul 31, 2024
e689ae7
chore: add py script
datamweb Aug 1, 2024
f56d512
refactor: update auto-update-copyright.yml
datamweb Aug 1, 2024
d6fd287
fix: route py file
datamweb Aug 1, 2024
00fb172
Update update_copyright.py
datamweb Aug 1, 2024
684dfd0
Update auto-update-copyright.yml
datamweb Aug 1, 2024
7f8a56b
Update update_copyright.py
datamweb Aug 1, 2024
55eabf9
Update auto-update-copyright.yml
datamweb Aug 1, 2024
319369e
Update auto-update-copyright.yml
datamweb Aug 1, 2024
7768529
fix: add base branch for open PR
datamweb Aug 1, 2024
21e0b1f
Update auto-update-copyright.yml
datamweb Aug 1, 2024
faedb36
Update auto-update-copyright.yml
datamweb Aug 1, 2024
57bc49b
Update auto-update-copyright.yml
datamweb Aug 1, 2024
40fc6b0
Update auto-update-copyright.yml
datamweb Aug 1, 2024
fb44549
Update auto-update-copyright.yml
datamweb Aug 1, 2024
f9977f8
chore(deps): bump actions/setup-python from 4 to 5
dependabot[bot] Aug 1, 2024
4a292e6
chore(deps): bump actions/checkout from 3 to 4
dependabot[bot] Aug 1, 2024
fa52e26
Update auto-update-copyright.yml
datamweb Aug 2, 2024
2096bbe
Update auto-update-copyright.yml
datamweb Aug 2, 2024
df03dc6
Update auto-update-copyright.yml
datamweb Aug 2, 2024
62508bf
Update auto-update-copyright.yml
datamweb Aug 2, 2024
5b84bb2
Update auto-update-copyright.yml
datamweb Aug 2, 2024
8453edb
Update auto-update-copyright.yml
datamweb Aug 2, 2024
3b43694
Update auto-update-copyright.yml
datamweb Aug 2, 2024
51154bc
Update auto-update-copyright.yml
datamweb Aug 2, 2024
7ba7c12
Update auto-update-copyright.yml
datamweb Aug 2, 2024
de2a15f
Update auto-update-copyright.yml
datamweb Aug 2, 2024
4032dc1
Update auto-update-copyright.yml
datamweb Aug 2, 2024
55ed1aa
Update auto-update-copyright.yml
datamweb Aug 2, 2024
1cf2aa0
Delete .github/workflows/auto-update-copyright.yml
datamweb Aug 4, 2024
4dc8fe8
Delete .github/workflows/update_copyright.py
datamweb Aug 4, 2024
54917bb
chore(deps-dev): update rector/rector requirement from 1.2.2 to 1.2.3…
dependabot[bot] Aug 13, 2024
21ed34f
chore(deps-dev): update rector/rector requirement from 1.2.3 to 1.2.4…
dependabot[bot] Aug 26, 2024
93bd5ea
check for blocked users and prevent them from logging in
warcooft Sep 8, 2024
8d63fd2
apply coding standar suggest
warcooft Sep 8, 2024
7ef4c0d
chore(deps-dev): update rector/rector requirement from 1.2.4 to 1.2.5…
dependabot[bot] Sep 9, 2024
60b3497
fix: ensure ban check for existing users
warcooft Sep 9, 2024
43e3d72
feat: apply config setting
warcooft Sep 10, 2024
5a2c288
require codeigniter4/settings
warcooft Sep 10, 2024
cef4eec
remove unnecessary code
warcooft Sep 10, 2024
fcfbd8f
fix: add phpstan-ignore for setting func
warcooft Sep 10, 2024
4541621
fix: func not found, rm require package
warcooft Sep 11, 2024
73c5133
fix: invalid combination
warcooft Sep 11, 2024
d51c465
chore(deps-dev): update rector/rector requirement from 1.2.5 to 1.2.6
dependabot[bot] Oct 4, 2024
29d0af1
chore(deps-dev): update rector/rector requirement from 1.2.6 to 1.2.7…
dependabot[bot] Oct 14, 2024
cbe802b
chore(deps-dev): update rector/rector requirement from 1.2.7 to 1.2.8…
dependabot[bot] Oct 21, 2024
f5888f8
chore(deps-dev): update rector/rector requirement from 1.2.8 to 1.2.10
dependabot[bot] Nov 11, 2024
11e0b3c
feat: add translation for Brazilian Portuguese (pt-BR)
tardisblink Dec 14, 2024
cdc75e2
chore(deps): bump NexusPHP/no-merge-commits from 2.1.0 to 2.2.1
dependabot[bot] Jan 22, 2025
2c930f2
Add to migrations and update docs
evansharp Feb 24, 2025
2749fdc
PR updates based on conversations
evansharp Feb 26, 2025
06dc3a7
Coderabbit is kid of annoying eh?
evansharp Feb 26, 2025
2722b9e
fix property name to address #177
evansharp Apr 12, 2025
fb2b62c
Merge branch 'develop' of github.com:evansharp/shield-oauth into develop
evansharp Apr 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Therefore, you can add `first_name`, `last_name`, and `avatar` columns to table
```console
php spark migrate -n Datamweb\ShieldOAuth
```
The default size of the `username` field created by Shield is **30** characters. Since Oauth uses the `username` field for the user's email address, this often is not large enough. Consider increasing the size of this field to `VARCHAR(256)`. _The migrations make this change for you_.

> **Note**
> By default, `Shield OAuth` uses columns named `first_name`, `last_name`, and `avatar`.
Expand Down
11 changes: 10 additions & 1 deletion src/Database/Migrations/2022-10-20-182737_ShieldOAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,19 @@ public function up(): void
'type' => 'VARCHAR',
'constraint' => '1000',
'null' => true,
],
]
];

$this->forge->addColumn('users', $fields);

Comment on lines 56 to +57
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix the trailing comma formatting issue.

There's a formatting issue reported by PHPCSFixer regarding missing trailing commas.

        $this->forge->addColumn('users', $fields);

        $fields2 = [

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 GitHub Actions: PHPCSFixer

[error] 56-56: PHP CS Fixer: trailing_comma_in_multiline, binary_operator_spaces issues found. Please fix the formatting.

$fields2 = [
'username' => [
'type' => 'VARCHAR(256)',
'null' => true
]
];
Comment on lines +58 to +63
Copy link

@coderabbitai coderabbitai bot Feb 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix formatting issues and consider whether modifyColumn is the right approach.

There are several issues with this code block:

  1. Missing trailing comma after true (line 61)
  2. Inconsistent spacing around the equal sign
  3. modifyColumn() will only work if the column already exists, but may fail for new installations where the column doesn't exist yet
        $fields2 = [
            'username'     => [
                'type'     => 'VARCHAR(256)',
-                'null'     => true
+                'null'     => true,
            ]
        ];

Consider using addColumn() with an IF NOT EXISTS check or use a try-catch block to handle cases where the column might not exist yet:

try {
    // Try to modify if exists
    $this->forge->modifyColumn('users', $fields2);
} catch (\Exception $e) {
    // Add if it doesn't exist
    $this->forge->addColumn('users', $fields2);
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The field as created by CI Shield is nullable, so I maintained that. I would normally not modify this attribute at all, but CI docs for migrations state that nullable is buggy and should be set every time to ensure expected outcome.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@evansharp Thanks for clarifying about maintaining the nullable attribute - that makes sense and aligns with what we already know about CodeIgniter Shield's default behavior.

What about the other issues mentioned in the original comment? Specifically:

  1. The missing trailing comma after true
  2. The concern about using modifyColumn() which might fail for new installations where the column doesn't exist yet

Would you like to address these points as well?


✏️ Learnings added
Learnt from: evansharp
PR: datamweb/shield-oauth#186
File: src/Database/Migrations/2022-10-20-182737_ShieldOAuth.php:58-63
Timestamp: 2025-02-26T23:50:21.777Z
Learning: According to CodeIgniter documentation, the "nullable" attribute in migrations is buggy and should be explicitly set every time to ensure expected behavior, even when not changing this property.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: evansharp
PR: datamweb/shield-oauth#186
File: src/Database/Migrations/2022-10-20-182737_ShieldOAuth.php:0-0
Timestamp: 2025-02-26T23:48:09.146Z
Learning: The username field as created by CodeIgniter Shield is nullable by default, and maintaining this property is important when modifying the field in migrations.


$this->forge->modifyColumn('users', $fields2);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a developer has already run the migration, executing it again will have no effect because the migration system only detects new migrations.

Therefore, it's best to create a new migration file and apply the necessary changes there, according to what you have done. This ensures that your changes are properly applied to the database without modifying previous migrations.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that is a problem though. Any developer already using the library will already have handled this short field somehow; if anything, adjusting their table could break their fix.

I think it is something only necessary for a new installation and so updating the existing migration is all that is needed.

}

public function down(): void
Expand Down
2 changes: 1 addition & 1 deletion src/Libraries/GoogleOAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ protected function setColumnsName(string $nameOfProcess, $userInfo): array
{
if ($nameOfProcess === 'syncingUserInfo') {
return [
$this->config->usersColumnsName['first_name'] => $userInfo->name,
$this->config->usersColumnsName['first_name'] => $userInfo->given_name,
$this->config->usersColumnsName['last_name'] => $userInfo->family_name ?? null,
$this->config->usersColumnsName['avatar'] => $userInfo->picture,
];
Expand Down
Loading