From b0d87e5edfcb44015ee2d90b10da53fa8abc61df Mon Sep 17 00:00:00 2001 From: Corby Krick Date: Sun, 24 Mar 2013 16:31:45 -0500 Subject: [PATCH 1/6] Displaying errors on user login failures --- application/controllers/user.php | 6 ++-- application/views/user/login.php | 52 +++++++++++++++++++++++++++++++- 2 files changed, 53 insertions(+), 5 deletions(-) diff --git a/application/controllers/user.php b/application/controllers/user.php index 93e1d631..285d0acd 100644 --- a/application/controllers/user.php +++ b/application/controllers/user.php @@ -305,13 +305,11 @@ class User extends CI_Controller { $this->form_validation->set_rules('user_name', 'Username', 'required'); $this->form_validation->set_rules('user_password', 'Password', 'required'); - $data = $query->row(); - if ($this->form_validation->run() == FALSE) { - //$data['page_title'] = Login; + $data['page_title'] = "Login"; $this->load->view('layout/header', $data); $this->load->view('user/login'); @@ -324,7 +322,7 @@ class User extends CI_Controller { $this->user_model->update_session($data->user_id); redirect('dashboard'); } else { - $this->session->set_flashdata('notice', 'Incorrect username or password!'); + $this->session->set_flashdata('error', 'Incorrect username or password!'); redirect('user/login'); } } diff --git a/application/views/user/login.php b/application/views/user/login.php index b09a5df6..e6a28389 100644 --- a/application/views/user/login.php +++ b/application/views/user/login.php @@ -1,7 +1,57 @@ + + + + + + + + + + +
+ + +session->flashdata('notice') != '') { ?> +
+ session->flashdata('notice'); ?> +
+ + +session->flashdata('error') != '') { ?> +
+ session->flashdata('error'); ?> +
+ + + +
+ +
+ +

Log in

-
From 9310e174323f5730622954ecb4aec911c74c7b87 Mon Sep 17 00:00:00 2001 From: Corby Krick Date: Sun, 24 Mar 2013 16:42:36 -0500 Subject: [PATCH 2/6] Correcting lost user id data --- application/controllers/user.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/application/controllers/user.php b/application/controllers/user.php index 285d0acd..3bbe33c7 100644 --- a/application/controllers/user.php +++ b/application/controllers/user.php @@ -305,12 +305,11 @@ class User extends CI_Controller { $this->form_validation->set_rules('user_name', 'Username', 'required'); $this->form_validation->set_rules('user_password', 'Password', 'required'); + $data['user'] = $query->row(); if ($this->form_validation->run() == FALSE) { - $data['page_title'] = "Login"; - $this->load->view('layout/header', $data); $this->load->view('user/login'); $this->load->view('layout/footer'); @@ -319,7 +318,7 @@ class User extends CI_Controller { { if($this->user_model->login() == 1) { $this->session->set_flashdata('notice', 'User logged in'); - $this->user_model->update_session($data->user_id); + $this->user_model->update_session($data['user']->user_id); redirect('dashboard'); } else { $this->session->set_flashdata('error', 'Incorrect username or password!'); From 9ed103ba523a2316b6298557ba35c76285597c58 Mon Sep 17 00:00:00 2001 From: Corby Krick Date: Sun, 24 Mar 2013 16:45:26 -0500 Subject: [PATCH 3/6] Removing some JS that wasn't needed on this view. --- application/views/user/login.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/application/views/user/login.php b/application/views/user/login.php index e6a28389..7bd9edb7 100644 --- a/application/views/user/login.php +++ b/application/views/user/login.php @@ -2,8 +2,6 @@ - - From f230245c36fade7f4b89e37b8df15772df9ffdaf Mon Sep 17 00:00:00 2001 From: Corby Krick Date: Sun, 24 Mar 2013 16:47:18 -0500 Subject: [PATCH 4/6] Removing some JS that wasn't needed on this view. --- application/views/user/login.php | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/application/views/user/login.php b/application/views/user/login.php index 7bd9edb7..0c5a29c1 100644 --- a/application/views/user/login.php +++ b/application/views/user/login.php @@ -5,27 +5,6 @@ -
From 150d7bd3c16bad6a82cb1ca30481422df017daf4 Mon Sep 17 00:00:00 2001 From: Corby Krick Date: Sat, 30 Mar 2013 07:40:13 -0500 Subject: [PATCH 5/6] Adding a partial view for displaying messages to the user. --- application/views/layout/messages.php | 32 +++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 application/views/layout/messages.php diff --git a/application/views/layout/messages.php b/application/views/layout/messages.php new file mode 100644 index 00000000..da832f21 --- /dev/null +++ b/application/views/layout/messages.php @@ -0,0 +1,32 @@ + + + + + + +session->flashdata('notice') != '') { ?> +
+ session->flashdata('notice'); ?> +
+ + + +session->flashdata('warning') != '') { ?> +
+ session->flashdata('warning'); ?> +
+ + + +session->flashdata('error') != '') { ?> +
+ session->flashdata('error'); ?> +
+ + + + +
+ +
+ \ No newline at end of file From 1d8116052f15b1176f99a92277f6ccd5f0413329 Mon Sep 17 00:00:00 2001 From: Corby Krick Date: Sat, 30 Mar 2013 07:50:35 -0500 Subject: [PATCH 6/6] Now using the messages partial view to display errors to the user. --- application/views/lotw/export.php | 8 ++------ application/views/lotw/import.php | 1 + application/views/user/login.php | 29 +---------------------------- 3 files changed, 4 insertions(+), 34 deletions(-) diff --git a/application/views/lotw/export.php b/application/views/lotw/export.php index 1f755828..ddb7e94f 100644 --- a/application/views/lotw/export.php +++ b/application/views/lotw/export.php @@ -1,11 +1,7 @@
-

- session->flashdata('warning')) { ?> -
- session->flashdata('warning'); ?> -
- +

+load->view('layout/messages'); ?>

Step 1

Export an ADIF file of QSOs that have not been uploaded to LoTW. diff --git a/application/views/lotw/import.php b/application/views/lotw/import.php index beb32d69..2e346124 100644 --- a/application/views/lotw/import.php +++ b/application/views/lotw/import.php @@ -1,5 +1,6 @@

+load->view('layout/messages'); ?>
diff --git a/application/views/user/login.php b/application/views/user/login.php index 0c5a29c1..22ba8775 100644 --- a/application/views/user/login.php +++ b/application/views/user/login.php @@ -1,34 +1,7 @@ - - - - - - - -
- -session->flashdata('notice') != '') { ?> -
- session->flashdata('notice'); ?> -
- - -session->flashdata('error') != '') { ?> -
- session->flashdata('error'); ?> -
- - - -
- -
- -

Log in

- +load->view('layout/messages'); ?>