Added the registration form.
Still need a lot :)
This commit is contained in:
@@ -48,6 +48,13 @@ class IDF_Views
|
||||
*/
|
||||
public function login($request, $match)
|
||||
{
|
||||
if (isset($request->POST['action'])
|
||||
and $request->POST['action'] == 'new-user') {
|
||||
$login = (isset($request->POST['login'])) ? $request->POST['login'] : '';
|
||||
$url = Pluf_HTTP_URL_urlForView('IDF_Views::register', array(),
|
||||
array('login' => $login));
|
||||
return new Pluf_HTTP_Response_Redirect($url);
|
||||
}
|
||||
$v = new Pluf_Views();
|
||||
return $v->login($request, $match, Pluf::f('login_success_url'));
|
||||
}
|
||||
@@ -61,4 +68,31 @@ class IDF_Views
|
||||
return $views->logout($request, $match, Pluf::f('after_logout_page'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Registration.
|
||||
*
|
||||
* We just ask for login, email and to agree with the terms. Then,
|
||||
* we go ahead and send a confirmation email. The confirmation
|
||||
* email will allow to set the password, first name and last name
|
||||
* of the user.
|
||||
*/
|
||||
function register($request, $match)
|
||||
{
|
||||
$title = __('Create Your Account');
|
||||
if ($request->method == 'POST') {
|
||||
$form = new IDF_Form_Register($request->POST);
|
||||
if ($form->isValid()) {
|
||||
$user = $form->save();
|
||||
$url = Pluf_HTTP_URL_urlForView('IDF_Views::registerConfirmation');
|
||||
return new Pluf_HTTP_Response_Redirect($url);
|
||||
}
|
||||
} else {
|
||||
$init = (isset($request->GET['login'])) ? array('initial' => array('login' => $request->GET['login'])) : array();
|
||||
$form = new IDF_Form_Register(null, $init);
|
||||
}
|
||||
return Pluf_Shortcuts_RenderToResponse('register.html',
|
||||
array('page_title' => $title,
|
||||
'form' => $form),
|
||||
$request);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user