-
Notifications
You must be signed in to change notification settings - Fork 787
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
LoginController only for login flow #747
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
9ef38da
Merge pull request #2 from panique/develop
slaveek ec0756c
Create UserController
33865fd
Create RegisterController
60149a2
Move register and verify view files to view/register
41f82c2
Remove register and verify view files from view/login directory
35d1e12
Move register and user action methods to their new controllers
68e7b00
Rename view/register/register.php to index.php
8d6c6b3
Changed View->render and Redirect::to()
3991e31
Move view user action files to view/user directory
3683f0a
Fixed logout if CSRF not valid
314e245
Rename showProfile.php to index.php
17cca66
Fixed showCaptcha
c084b99
Changed form actions in user views
94f8473
Change form action in register views
fa2cc4c
Fixed links in right menu
8904ac2
Fixed typo
1c3faf9
Move Auth::checkAuthentication() to constructor
90d6f2b
Fixed register link
cdde4ef
Fixed major and minor changes missed
851d594
Improved logout
9141b70
Revert "Improved logout"
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
|
||
/** | ||
* RegisterController | ||
* Register new user | ||
*/ | ||
class RegisterController extends Controller | ||
{ | ||
/** | ||
* Construct this object by extending the basic Controller class. The parent::__construct thing is necessary to | ||
* put checkAuthentication in here to make an entire controller only usable for logged-in users (for sure not | ||
* needed in the RegisterController). | ||
*/ | ||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
} | ||
|
||
/** | ||
* Register page | ||
* Show the register form, but redirect to main-page if user is already logged-in | ||
*/ | ||
public function index() | ||
{ | ||
if (LoginModel::isUserLoggedIn()) { | ||
Redirect::home(); | ||
} else { | ||
$this->View->render('register/index'); | ||
} | ||
} | ||
|
||
/** | ||
* Register page action | ||
* POST-request after form submit | ||
*/ | ||
public function register_action() | ||
{ | ||
$registration_successful = RegistrationModel::registerNewUser(); | ||
|
||
if ($registration_successful) { | ||
Redirect::to('login/index'); | ||
} else { | ||
Redirect::to('register/index'); | ||
} | ||
} | ||
|
||
/** | ||
* Verify user after activation mail link opened | ||
* @param int $user_id user's id | ||
* @param string $user_activation_verification_code user's verification token | ||
*/ | ||
public function verify($user_id, $user_activation_verification_code) | ||
{ | ||
if (isset($user_id) && isset($user_activation_verification_code)) { | ||
RegistrationModel::verifyNewUser($user_id, $user_activation_verification_code); | ||
$this->View->render('register/verify'); | ||
} else { | ||
Redirect::to('login/index'); | ||
} | ||
} | ||
|
||
/** | ||
* Generate a captcha, write the characters into $_SESSION['captcha'] and returns a real image which will be used | ||
* like this: <img src="......./login/showCaptcha" /> | ||
* IMPORTANT: As this action is called via <img ...> AFTER the real application has finished executing (!), the | ||
* SESSION["captcha"] has no content when the application is loaded. The SESSION["captcha"] gets filled at the | ||
* moment the end-user requests the <img .. > | ||
* Maybe refactor this sometime. | ||
*/ | ||
public function showCaptcha() | ||
{ | ||
CaptchaModel::generateAndShowCaptcha(); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this be better as index_action() to fit the naming pattern used for action-action_post_handler theme used throughout this framework.
Corresponding change would be needed here: https://github.com/panique/huge/pull/747/files?diff=unified#diff-5ac2d5faa50e65202dd471632e2632f2R11 (application/view/register/index.php L11)