Indefero

Indefero Commit Details


Date:2008-12-19 04:46:46 (16 years 3 days ago)
Author:Loic d'Anterroches
Branch:dev, develop, feature-issue_links, feature.better-home, feature.content-md5, feature.diff-whitespace, feature.download-md5, feature.issue-links, feature.issue-of-others, feature.issue-summary, feature.search-filter, feature.webrepos, feature.wiki-default-page, master, release-1.1, release-1.2, release-1.3
Commit:d29267875974c1e7dac2ba88e78a626e7cba2348
Parents: f6fb6c5ccc6252c9a20a73169698755e70cec726
Message:Added the initialisation of the user language at registration time.

When the user register, we grab the language from the browser and use it
as first value for the corresponding user object. The user can then
later on modify it from his account area.
Changes:

File differences

src/IDF/Form/Register.php
2727
2828
2929
30
31
3032
3133
34
3235
3336
3437
......
115118
116119
117120
121
118122
119123
120124
*/
class IDF_Form_Register extends Pluf_Form
{
protected $request;
public function initFields($extra=array())
{
$this->request = $extra['request'];
$login = '';
if (isset($extra['initial']['login'])) {
$login = $extra['initial']['login'];
$user->last_name = $this->cleaned_data['login'];
$user->login = $this->cleaned_data['login'];
$user->email = $this->cleaned_data['email'];
$user->language = $this->request->language_code;
$user->active = false;
$user->create();
$from_email = Pluf::f('from_email');
src/IDF/Form/RegisterConfirmation.php
6363
6464
6565
66
6667
6768
6869
'size' => 15,
),
));
$this->fields['password'] = new Pluf_Form_Field_Varchar(
array('required' => true,
'label' => __('Your password'),
src/IDF/Views.php
8484
8585
8686
87
8788
88
89
8990
9091
9192
9293
9394
9495
95
96
96
97
98
99
97100
98101
99102
function register($request, $match)
{
$title = __('Create Your Account');
$params = array('request'=>$request);
if ($request->method == 'POST') {
$form = new IDF_Form_Register($request->POST);
$form = new IDF_Form_Register($request->POST, $params);
if ($form->isValid()) {
$user = $form->save(); // It is sending the confirmation email
$url = Pluf_HTTP_URL_urlForView('IDF_Views::registerInputKey');
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);
if (isset($request->GET['login'])) {
$params['initial'] = array('login' => $request->GET['login']);
}
$form = new IDF_Form_Register(null, $params);
}
$context = new Pluf_Template_Context(array());
$tmpl = new Pluf_Template('idf/terms.html');

Archive Download the corresponding diff file

Page rendered in 0.09170s using 13 queries.