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

[REFACTORING/IMPROVEMENT] 1-minimal deep rewrite #98

Closed
wants to merge 33 commits into from
Closed

[REFACTORING/IMPROVEMENT] 1-minimal deep rewrite #98

wants to merge 33 commits into from

Conversation

nyamsprod
Copy link

I have rewrote the Minimal to better filter and validated input data and to simplify the code. In doing so I have:

  • Created an Auth class that is extended by the Registration and the Login class
  • The Auth class initiate the database connection and handles the possible errors;
  • Errors are represented by constant in the Auth class to better handle script localization and are always attach to a context.
  • I've used the php filter_ functions to better validate user input data
  • I've added a user_token property in the session to also validate a user already connected this can help to prevent session corruption and add a session timeout functionnality.
  • In the db.php file I have added the constant DB_CHARSET which is needed to better sanitize data before injecting them into the database.
  • I've added Docblocks to almost every method and/or property

Of course, the views and the mains script have been updated accordingly by adding a require to the Auth.php class

Rewrite by taking advantage of PHP filter functions
added charset set up in DB connection parameters
added DB charset and using PHP 5.3+ const definition
Updated Error message to better handle internationalisation move DB connection into the constructor method
Merge methods and properties between Registration.php and Login.php
Login is rewrite to extends Auth
Base Class to be extended by Login and Registration
using Auth::$regexp to normalize pattern info
@panique
Copy link
Owner

panique commented Jul 1, 2013

Excellent work, BIG thanks from my side! But unfortunatly you have written this in the master branch. All changes are always pushed into develop branch and tested there until declared stable, and then merged into master branch. So, can you please open a new branch for your changes OR do it in the develop ? As a lot of people download this every day we cannot publish untested stuff directly in master...

Thanks again, i love your work!

@panique
Copy link
Owner

panique commented Jul 1, 2013

Another note on that: Your code is really professional, and i think it's TOO professional! The problem here is that it's not self-explaining and easy-to-change for most people (?). The goal of this project was always to keep the code very easy, understandable and without high-end-code-constructs. Please don't me wrong, i totally love your code, but some parts of Registration.php might be too advanced to this SIMPLE script. I think a lot of non-advanced people are using the script and they should be able to understand nearly every line of code by simply reading them... Let's discuss this!

@panique
Copy link
Owner

panique commented Jul 1, 2013

@the4ndy Don't know what you mean, maybe you have unintentionally subscribed to this thread ? Usually you should not get any mails from github unless you are the author of a project or have explicitly subscribed to something. It's not in my hands, sorry...

@nyamsprod
Copy link
Author

Okay I'll create a new branch then not a problem. As for the TOO professional I think the major problem would be with the error reporting and the session timeout other than that everything else is self explanatory (in my view) . When I did the error changes I though of that myself but I think it can be mitigated with a good example ? What do you think ?

@nyamsprod nyamsprod closed this Jul 2, 2013
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.

None yet

3 participants