Ticket #499: swt_auth_demo_controller.patch
| File swt_auth_demo_controller.patch, 1.3 kB (added by Stalwart, 10 months ago) |
|---|
-
.php
old new 37 27 { 38 28 $form = new Forge(NULL, 'Create User'); 39 29 40 $form->input('email')->label(TRUE)->rules('required| length[4,32]');30 $form->input('email')->label(TRUE)->rules('required|valid_email'); 41 31 $form->input('username')->label(TRUE)->rules('required|length[4,32]'); 42 32 $form->password('password')->label(TRUE)->rules('required|length[5,40]'); 43 33 $form->submit('Create New User'); … … 47 37 // Create new user 48 38 $user = new User_Model; 49 39 50 if ( ! $user->username_exists($this->input->post('username'))) 40 if ( ! $user->username_exists($this->input->post('username')) 41 AND ! $user->email_exists($this->input->post('email'))) 51 42 { 52 43 foreach($form->as_array() as $key => $val) 53 44 { … … 57 48 58 49 if ($user->save() AND $user->add_role('login')) 59 50 { 51 // Log in created user 52 $this->auth->login($user, $this->input->post('password')); 53 60 54 // Redirect to the login page 61 55 url::redirect('auth/login'); 62 56 }
