-
-
Save kitsunet/2035708 to your computer and use it in GitHub Desktop.
Create Account
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
<f:flashMessages /> | |
<f:form action="create" controller="Login" method="post" name="createform"> | |
<div><label>Email:</label><f:form.textfield name="email" /></div> | |
<div><label>Password:</label><f:form.textfield name="pw" /></div> | |
<div><label>Repeat Password:</label><f:form.textfield name="pwr" /></div> | |
<div><label>Username:</label><f:form.textfield name="uname" /></div> | |
<f:form.submit value="Register and Login" /> | |
</f:form> |
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
<?php | |
namespace Me\My\Controller; | |
/* * | |
* This script belongs to the FLOW3 package "Me.My". * | |
* * | |
* */ | |
use TYPO3\FLOW3\Annotations as FLOW3; | |
/** | |
* Login controller for the Me.My package | |
* | |
* @FLOW3\Scope("singleton") | |
*/ | |
class LoginController extends \TYPO3\FLOW3\MVC\Controller\ActionController { | |
/** | |
* save the registration | |
* @param string $email email | |
* @param string $pw password | |
* @param string $pwr password repeat | |
* @param string $uname username | |
* @FLOW3\Validate(argumentName="email", type="EmailAdress") | |
* @FLOW3\Validate(argumentName="email", type="NotEmpty") | |
*/ | |
public function createAction($email,$pw,$pwr,$uname) { | |
$defaultRole = 'User'; | |
if($email == '' || strlen($email) < 3) { | |
$this->addFlashMessage('Username too short or empty'); | |
$this->redirect('register', 'Login'); | |
} else if($pw == '' || $pw != $pwr) { | |
$this->addFlashMessage('Password too short or does not match'); | |
$this->redirect('register', 'Login'); | |
} else { | |
$account = $this->accountFactory->createAccountWithPassword($email,$pw, array($defaultRole)); | |
$account->setAuthenticationProviderName('DefaultProvider'); | |
$this->accountRepository->add($account); | |
// add a message and redirect to the login form | |
$this->addFlashMessage('Account created. Please login.'); | |
$this->redirect('index'); | |
// TODO: create and add party | |
} | |
// redirect to the login form | |
$this->redirect('index', 'Login'); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment