Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a make:user command #250

Merged
merged 7 commits into from
Aug 30, 2018
Merged

Adding a make:user command #250

merged 7 commits into from
Aug 30, 2018

Conversation

weaverryan
Copy link
Member

Hi guys!

My latest experiment πŸ‘¨πŸ»β€πŸ”¬!

User is an Entity
screen shot 2018-08-28 at 2 16 20 pm

User is a Model Class
screen shot 2018-08-28 at 2 11 38 pm

This walks people through some of the most confusing parts of starting with Symfony's security so that they can get straight to writing authenticators.

A) It can generate an entity or non-entity User class
B) It sets up your User::getUsername() method correctly, which can be confusing... because often you don't have a username (e.g. you have an email)
C) It correctly fills in getSalt() and getPassword() based on whether or not your app actually needs to check passwords
D) It updates the providers and encoders sections in security.yaml file without losing formatting or comments. If this process fails (it's not perfect), the command will tell you exactly what YAML to update. It defaults to using argon2i when the system supports it.

Example generated User class source: tests/Security/fixtures/expected/*
Example generated security.yaml source: tests/Security/yaml_fixtures/expected_user_class/*

I'd love to have feedback from people trying it. You should be able to switch to the dev-make-user branch of this repository to get it.

Cheers!

@weaverryan weaverryan force-pushed the make-user branch 3 times, most recently from efdf35d to 3c6c8e0 Compare August 28, 2018 18:39
@dunglas
Copy link
Member

dunglas commented Aug 28, 2018

I really like the idea!

@weaverryan
Copy link
Member Author

Test failures are due to some unrelated deprecations and a pesky Windows false failure I'm debugging elsewhere :)

@weaverryan weaverryan merged commit c5fb5df into master Aug 30, 2018
weaverryan added a commit that referenced this pull request Aug 30, 2018
This PR was squashed before being merged into the 1.0-dev branch (closes #250).

Discussion
----------

Adding a make:user command

Hi guys!

My latest experiment πŸ‘¨πŸ»β€πŸ”¬!

**User is an Entity**
<img width="1277" alt="screen shot 2018-08-28 at 2 16 20 pm" src="https://user-images.githubusercontent.com/121003/44742077-faa57d80-aacc-11e8-8f73-acce0b669c7a.png">

**User is a Model Class**
<img width="1278" alt="screen shot 2018-08-28 at 2 11 38 pm" src="https://user-images.githubusercontent.com/121003/44742324-98994800-aacd-11e8-8ddd-8e52310dc61a.png">

This walks people through some of the most confusing parts of starting with Symfony's security so that they can get straight to writing authenticators.

A) It can generate an **entity or non-entity** `User` class
B) It sets up your **`User::getUsername()` method correctly**, which can be confusing... because often you don't have a username (e.g. you have an email)
C) It correctly **fills in `getSalt()` and `getPassword()`** based on whether or not your app actually *needs* to check passwords
D) It **updates** the `providers` and `encoders` sections in **`security.yaml` file without losing formatting or comments**. If this process fails (it's not perfect), the command will tell you exactly what YAML to update. It defaults to using `argon2i` when the system supports it.

Example generated `User` class source:  `tests/Security/fixtures/expected/*`
Example generated `security.yaml` source:  `tests/Security/yaml_fixtures/expected_user_class/`*

I'd love to have feedback from people trying it. You should be able to switch to the `dev-make-user` branch of this repository to get it.

Cheers!

Commits
-------

c5fb5df more phpcs fixing
603a815 reducing length of unique field to avoid index length problems
f6e273a Not requiring \in_array() style on generated code
23116fa bumping MySQL sever_version to 5.6 to fix Travis & JSON fields
3a40c86 updating to latest phpcs
c44b1d5 Getting info about cs problems
93a846d Adding make:user command
@OskarStark
Copy link
Contributor

@weaverryan the branch should be removed ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants