diff --git a/application/config/migration.php b/application/config/migration.php index a6519c61..6fc48a75 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -22,7 +22,7 @@ $config['migration_enabled'] = TRUE; | */ -$config['migration_version'] = 166; +$config['migration_version'] = 167; /* |-------------------------------------------------------------------------- diff --git a/application/controllers/User.php b/application/controllers/User.php index 50a04105..927ceffd 100644 --- a/application/controllers/User.php +++ b/application/controllers/User.php @@ -695,6 +695,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']->user_id); + $this->user_model->set_last_login($data['user']->user_id); $cookie= array( 'name' => 'language', @@ -804,6 +805,85 @@ class User extends CI_Controller { } } + // Send an E-Mail to the user. Function is similar to forgot_password() + function admin_send_passwort_reset() { + + $this->load->model('user_model'); + if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + $query = $this->user_model->get_by_id($this->uri->segment(3)); + + $this->load->library('form_validation'); + + $this->form_validation->set_rules('id', 'user_id', 'required'); + + $data = $query->row(); + + if ($this->form_validation->run() != FALSE) + { + $this->session->set_flashdata('notice', 'Something went wrong! User has no user_id.'); + redirect('user'); + } + else + { + // Check email address exists + $this->load->model('user_model'); + + $check_email = $this->user_model->check_email_address($data->user_email); + + if($check_email == TRUE) { + // Generate password reset code 50 characters long + $this->load->helper('string'); + $reset_code = random_string('alnum', 50); + $this->user_model->set_password_reset_code(($data->user_email), $reset_code); + + // Send email with reset code and first Name of the User + + $this->data['reset_code'] = $reset_code; + $this->data['user_firstname'] = $data->user_firstname; // We can call the user by his first name in the E-Mail + $this->data['user_callsign'] = $data->user_callsign; + $this->data['user_name'] = $data->user_name; + $this->load->library('email'); + + if($this->optionslib->get_option('emailProtocol') == "smtp") { + $config = Array( + 'protocol' => $this->optionslib->get_option('emailProtocol'), + 'smtp_crypto' => $this->optionslib->get_option('smtpEncryption'), + 'smtp_host' => $this->optionslib->get_option('smtpHost'), + 'smtp_port' => $this->optionslib->get_option('smtpPort'), + 'smtp_user' => $this->optionslib->get_option('smtpUsername'), + 'smtp_pass' => $this->optionslib->get_option('smtpPassword'), + 'crlf' => "\r\n", + 'newline' => "\r\n" + ); + + $this->email->initialize($config); + } + + $message = $this->load->view('email/admin_reset_password', $this->data, TRUE); + + $this->email->from($this->optionslib->get_option('emailAddress'), $this->optionslib->get_option('emailSenderName')); + $this->email->to($data->user_email); + $this->email->subject('Cloudlog Account Password Reset'); + $this->email->message($message); + + if (! $this->email->send()) + { + // Redirect to user page with message + $this->session->set_flashdata('danger', lang('admin_email_settings_incorrect')); + redirect('user'); + } else { + // Redirect to user page with message + $this->session->set_flashdata('success', lang('admin_password_reset_processed')); + redirect('user'); + } + } else { + // No account found just return to user page + $this->session->set_flashdata('danger', 'Nothing done. No user found.'); + redirect('user'); + } + } + } + function reset_password($reset_code = NULL) { $data['reset_code'] = $reset_code; diff --git a/application/language/bulgarian/admin_lang.php b/application/language/bulgarian/admin_lang.php index e48558ba..88b5d392 100644 --- a/application/language/bulgarian/admin_lang.php +++ b/application/language/bulgarian/admin_lang.php @@ -5,27 +5,32 @@ defined('BASEPATH') OR exit('Не е разрешен директен дост $lang['admin_user_line1'] = 'Cloudlog needs at least one user configured in order to operate.'; $lang['admin_user_line2'] = 'Users can be assigned roles which give them different permissions, such as adding QSOs to the logbook and accessing Cloudlog APIs.'; $lang['admin_user_line3'] = 'The currently logged-in user is displayed at the upper-right of each page.'; +$lang['admin_user_line4'] = "With the password reset button, you can send a user an email containing a link to reset their password. To achieve this, ensure that the email settings in the global options are configured correctly."; $lang['admin_user_list'] = 'User List'; $lang['admin_user'] = 'User'; $lang['admin_email'] = 'E-mail'; $lang['admin_type'] = 'Type'; +$lang['admin_last_login'] = "Last Login"; $lang['admin_options'] = 'Options'; $lang['admin_create_user'] = 'Create user'; $lang['admin_delete'] = 'Delete'; -$lang['admin_remove'] = "Remove"; +$lang['admin_remove'] = "Remove"; $lang['admin_edit'] = 'Edit'; -$lang['admin_create'] = 'Create'; -$lang['admin_update'] = 'Update'; -$lang['admin_copy'] = 'Copy'; -$lang['admin_save'] = 'Save'; -$lang['admin_close'] = 'Close'; +$lang['admin_create'] = 'Create'; +$lang['admin_update'] = 'Update'; +$lang['admin_copy'] = 'Copy'; +$lang['admin_save'] = 'Save'; +$lang['admin_close'] = 'Close'; $lang['admin_user_accounts'] = 'User Accounts'; -$lang['admin_danger'] = 'DANGER!'; -$lang['admin_experimental'] = "Experimental"; +$lang['admin_danger'] = 'DANGER!'; +$lang['admin_experimental'] = "Experimental"; +$lang['admin_password_reset'] = "Password Reset"; +$lang['admin_email_settings_incorrect'] = "Email settings are incorrect."; +$lang['admin_password_reset_processed'] = "Password Reset E-Mail sent."; // Contest Menu @@ -40,16 +45,16 @@ $lang['admin_contest_menu_activate'] = 'Activate'; $lang['admin_contest_menu_deactivate'] = 'Deactivate'; $lang['admin_contest_add_contest'] = 'Add a Contest'; -$lang["admin_contest_create"] = "Create"; +$lang["admin_contest_create"] = "Create"; $lang['admin_contest_all_active'] = 'Activate All'; $lang['admin_contest_all_deactive'] = 'Deactivate All'; $lang['admin_contest_name_adif'] = 'Contest ADIF Name'; $lang['admin_contest_name_of_contest'] = 'Name of the Contest'; $lang['admin_contest_name_of_adif'] = 'Name of Contest in ADIF-specification'; -$lang['admin_contest_edit_active_hint'] = 'Set to active if to be listed in Contest-list'; -$lang['admin_contest_edit_update_contest'] = 'Update Contest'; -$lang['admin_contest_deletion_warning'] = 'Warning! Are you sure you want to delete the following contest: '; -$lang['admin_contest_active_all_warning'] = 'Warning! Are you sure you want to activate all contests?'; -$lang['admin_contest_deactive_all_warning'] = 'Warning! Are you sure you want to deactivate all contests?'; +$lang['admin_contest_edit_active_hint'] = 'Set to active if to be listed in Contest-list'; +$lang['admin_contest_edit_update_contest'] = 'Update Contest'; +$lang['admin_contest_deletion_warning'] = 'Warning! Are you sure you want to delete the following contest: '; +$lang['admin_contest_active_all_warning'] = 'Warning! Are you sure you want to activate all contests?'; +$lang['admin_contest_deactive_all_warning'] = 'Warning! Are you sure you want to deactivate all contests?'; diff --git a/application/language/bulgarian/general_words_lang.php b/application/language/bulgarian/general_words_lang.php index 48ecdc09..9c4889bf 100644 --- a/application/language/bulgarian/general_words_lang.php +++ b/application/language/bulgarian/general_words_lang.php @@ -25,6 +25,7 @@ $lang['general_word_count'] = "Count"; $lang['general_word_filtering_on'] = "Filtering on"; $lang['general_word_not_display'] = "Not display"; $lang['general_word_icon'] = "Icon"; +$lang['general_word_never'] = "Never"; $lang['general_word_date'] = 'Дата'; $lang['general_word_startdate'] = "Start Date"; diff --git a/application/language/chinese_simplified/admin_lang.php b/application/language/chinese_simplified/admin_lang.php index 994d8d9e..05819370 100644 --- a/application/language/chinese_simplified/admin_lang.php +++ b/application/language/chinese_simplified/admin_lang.php @@ -5,12 +5,14 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $lang['admin_user_line1'] = 'Cloudlog至少需要配置一个用户才能运行。'; $lang['admin_user_line2'] = '用户可以被分配不同的角色,这些角色赋予他们不同的权限,例如向日志簿添加 QSO 和访问Cloudlog API。'; $lang['admin_user_line3'] = '页面右上方显示当前登录的用户。'; +$lang['admin_user_line4'] = "With the password reset button, you can send a user an email containing a link to reset their password. To achieve this, ensure that the email settings in the global options are configured correctly."; $lang['admin_user_list'] = '用户列表'; $lang['admin_user'] = '用户名'; $lang['admin_email'] = '电子邮件'; $lang['admin_type'] = '用户类型'; +$lang['admin_last_login'] = "Last Login"; $lang['admin_options'] = '设置'; $lang['admin_create_user'] = '创建用户'; @@ -25,7 +27,10 @@ $lang['admin_close'] = '关闭'; $lang['admin_user_accounts'] = '用户账户'; $lang['admin_danger'] = '危险!'; $lang['admin_experimental'] = "实验性功能"; +$lang['admin_password_reset'] = "Password Reset"; +$lang['admin_email_settings_incorrect'] = "Email settings are incorrect."; +$lang['admin_password_reset_processed'] = "Password Reset E-Mail sent."; // Contest Menu diff --git a/application/language/chinese_simplified/general_words_lang.php b/application/language/chinese_simplified/general_words_lang.php index 6248f91e..f3bf6054 100644 --- a/application/language/chinese_simplified/general_words_lang.php +++ b/application/language/chinese_simplified/general_words_lang.php @@ -25,6 +25,7 @@ $lang['general_word_count'] = "数量"; $lang['general_word_filtering_on'] = "筛选打开"; $lang['general_word_not_display'] = "Not display"; $lang['general_word_icon'] = "Icon"; +$lang['general_word_never'] = "Never"; $lang['general_word_date'] = '日期'; $lang['general_word_startdate'] = "开始时间"; diff --git a/application/language/czech/admin_lang.php b/application/language/czech/admin_lang.php index 890fb449..d0cb04ac 100644 --- a/application/language/czech/admin_lang.php +++ b/application/language/czech/admin_lang.php @@ -5,12 +5,14 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $lang['admin_user_line1'] = 'Cloudlog potřebuje alespoň jednoho uživatele nastaveného pro svůj provoz.'; $lang['admin_user_line2'] = 'Uživatelům mohou být přiděleny role, které jim udělují různá oprávnění, jako je přidávání QSO do logu a přístup k Cloudlog API.'; $lang['admin_user_line3'] = 'Nyní přihlášený uživatel je zobrazen v pravém horním rohu každé stránky.'; +$lang['admin_user_line4'] = "With the password reset button, you can send a user an email containing a link to reset their password. To achieve this, ensure that the email settings in the global options are configured correctly."; $lang['admin_user_list'] = 'Seznam uživatelů'; $lang['admin_user'] = 'Uživatel'; $lang['admin_email'] = 'E-mail'; $lang['admin_type'] = 'Typ'; +$lang['admin_last_login'] = "Last Login"; $lang['admin_options'] = 'Možnosti'; $lang['admin_create_user'] = 'Vytvořit uživatele'; @@ -25,7 +27,10 @@ $lang['admin_close'] = 'Close'; $lang['admin_user_accounts'] = 'User Accounts'; $lang['admin_danger'] = 'DANGER!'; $lang['admin_experimental'] = "Experimental"; +$lang['admin_password_reset'] = "Password Reset"; +$lang['admin_email_settings_incorrect'] = "Email settings are incorrect."; +$lang['admin_password_reset_processed'] = "Password Reset E-Mail sent."; // Contest Menu diff --git a/application/language/czech/general_words_lang.php b/application/language/czech/general_words_lang.php index 4615e07d..e6129f04 100644 --- a/application/language/czech/general_words_lang.php +++ b/application/language/czech/general_words_lang.php @@ -25,6 +25,7 @@ $lang['general_word_count'] = "Count"; $lang['general_word_filtering_on'] = "Filtering on"; $lang['general_word_not_display'] = "Not display"; $lang['general_word_icon'] = "Icon"; +$lang['general_word_never'] = "Never"; $lang['general_word_date'] = 'Datum'; $lang['general_word_startdate'] = "Start Date"; diff --git a/application/language/dutch/admin_lang.php b/application/language/dutch/admin_lang.php index 2f498237..a0fbce5c 100644 --- a/application/language/dutch/admin_lang.php +++ b/application/language/dutch/admin_lang.php @@ -5,12 +5,14 @@ defined('BASEPATH') OR exit('Directe toegang tot scripts is niet toegestaan'); $lang['admin_user_line1'] = 'Cloudlog needs at least one user configured in order to operate.'; $lang['admin_user_line2'] = 'Users can be assigned roles which give them different permissions, such as adding QSOs to the logbook and accessing Cloudlog APIs.'; $lang['admin_user_line3'] = 'The currently logged-in user is displayed at the upper-right of each page.'; +$lang['admin_user_line4'] = "With the password reset button, you can send a user an email containing a link to reset their password. To achieve this, ensure that the email settings in the global options are configured correctly."; $lang['admin_user_list'] = 'User List'; $lang['admin_user'] = 'User'; $lang['admin_email'] = 'E-mail'; $lang['admin_type'] = 'Type'; +$lang['admin_last_login'] = "Last Login"; $lang['admin_options'] = 'Options'; $lang['admin_create_user'] = 'Create user'; @@ -25,7 +27,10 @@ $lang['admin_close'] = 'Close'; $lang['admin_user_accounts'] = 'User Accounts'; $lang['admin_danger'] = 'DANGER!'; $lang['admin_experimental'] = "Experimental"; +$lang['admin_password_reset'] = "Password Reset"; +$lang['admin_email_settings_incorrect'] = "Email settings are incorrect."; +$lang['admin_password_reset_processed'] = "Password Reset E-Mail sent."; // Contest Menu diff --git a/application/language/dutch/general_words_lang.php b/application/language/dutch/general_words_lang.php index dfe9e6ab..82903a67 100644 --- a/application/language/dutch/general_words_lang.php +++ b/application/language/dutch/general_words_lang.php @@ -25,6 +25,7 @@ $lang['general_word_count'] = "Count"; $lang['general_word_filtering_on'] = "Filtering on"; $lang['general_word_not_display'] = "Not display"; $lang['general_word_icon'] = "Icon"; +$lang['general_word_never'] = "Never"; $lang['general_word_date'] = 'Datum'; $lang['general_word_startdate'] = "Start Date"; diff --git a/application/language/english/admin_lang.php b/application/language/english/admin_lang.php index f045c1a9..2560697f 100644 --- a/application/language/english/admin_lang.php +++ b/application/language/english/admin_lang.php @@ -5,12 +5,14 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $lang['admin_user_line1'] = 'Cloudlog needs at least one user configured in order to operate.'; $lang['admin_user_line2'] = 'Users can be assigned roles which give them different permissions, such as adding QSOs to the logbook and accessing Cloudlog APIs.'; $lang['admin_user_line3'] = 'The currently logged-in user is displayed at the upper-right of each page.'; +$lang['admin_user_line4'] = "With the password reset button, you can send a user an email containing a link to reset their password. To achieve this, ensure that the email settings in the global options are configured correctly."; $lang['admin_user_list'] = 'User List'; $lang['admin_user'] = 'User'; $lang['admin_email'] = 'E-mail'; $lang['admin_type'] = 'Type'; +$lang['admin_last_login'] = "Last Login"; $lang['admin_options'] = 'Options'; $lang['admin_create_user'] = 'Create user'; @@ -25,7 +27,10 @@ $lang['admin_close'] = 'Close'; $lang['admin_user_accounts'] = 'User Accounts'; $lang['admin_danger'] = 'DANGER!'; $lang['admin_experimental'] = "Experimental"; +$lang['admin_password_reset'] = "Password Reset"; +$lang['admin_email_settings_incorrect'] = "Email settings are incorrect."; +$lang['admin_password_reset_processed'] = "Password Reset E-Mail sent."; // Contest Menu diff --git a/application/language/english/general_words_lang.php b/application/language/english/general_words_lang.php index 93793b1d..b59d66ad 100644 --- a/application/language/english/general_words_lang.php +++ b/application/language/english/general_words_lang.php @@ -25,6 +25,7 @@ $lang['general_word_count'] = "Count"; $lang['general_word_filtering_on'] = "Filtering on"; $lang['general_word_not_display'] = "Not display"; $lang['general_word_icon'] = "Icon"; +$lang['general_word_never'] = "Never"; $lang['general_word_date'] = 'Date'; $lang['general_word_startdate'] = "Start Date"; diff --git a/application/language/finnish/admin_lang.php b/application/language/finnish/admin_lang.php index ca8b5d12..8c1ed2b8 100644 --- a/application/language/finnish/admin_lang.php +++ b/application/language/finnish/admin_lang.php @@ -5,12 +5,14 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $lang['admin_user_line1'] = 'Cloudlog tarvitsee toimiakseen vähintään yhden luodun käyttäjän.'; $lang['admin_user_line2'] = 'Käyttäjille voidaan määrittää rooleja, jotka antavat heille erilaisia käyttöoikeuksia, kuten QSO:n lisääminen lokikirjaan ja pääsy Cloudlog-sovellusliittymiin (API).'; $lang['admin_user_line3'] = 'Tällä hetkellä kirjautunut käyttäjä näkyy jokaisen sivun oikeassa yläkulmassa.'; +$lang['admin_user_line4'] = "With the password reset button, you can send a user an email containing a link to reset their password. To achieve this, ensure that the email settings in the global options are configured correctly."; $lang['admin_user_list'] = 'Käyttäjälista'; $lang['admin_user'] = 'Käyttäjä'; $lang['admin_email'] = 'E-mail'; $lang['admin_type'] = 'Rooli'; +$lang['admin_last_login'] = "Last Login"; $lang['admin_options'] = 'Valinnat'; $lang['admin_create_user'] = 'Luo käyttäjä'; @@ -25,7 +27,10 @@ $lang['admin_close'] = 'Close'; $lang['admin_user_accounts'] = 'User Accounts'; $lang['admin_danger'] = 'DANGER!'; $lang['admin_experimental'] = "Experimental"; +$lang['admin_password_reset'] = "Password Reset"; +$lang['admin_email_settings_incorrect'] = "Email settings are incorrect."; +$lang['admin_password_reset_processed'] = "Password Reset E-Mail sent."; // Contest Menu diff --git a/application/language/finnish/general_words_lang.php b/application/language/finnish/general_words_lang.php index 07794d42..7a384376 100644 --- a/application/language/finnish/general_words_lang.php +++ b/application/language/finnish/general_words_lang.php @@ -25,6 +25,7 @@ $lang['general_word_count'] = "Count"; $lang['general_word_filtering_on'] = "Filtering on"; $lang['general_word_not_display'] = "Not display"; $lang['general_word_icon'] = "Icon"; +$lang['general_word_never'] = "Never"; $lang['general_word_date'] = 'Päivä'; $lang['general_word_startdate'] = "Start Date"; diff --git a/application/language/french/admin_lang.php b/application/language/french/admin_lang.php index b76b67ff..d87c4285 100644 --- a/application/language/french/admin_lang.php +++ b/application/language/french/admin_lang.php @@ -5,12 +5,14 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $lang['admin_user_line1'] = "Cloudlog a besoin d'au moins un utilisateur configuré pour fonctionner."; $lang['admin_user_line2'] = "Les utilisateurs peuvent se voir attribuer des rôles qui leur donnent différentes autorisations, telles que l'ajout de QSO au journal de trafic et l'accès aux API Cloudlog."; $lang['admin_user_line3'] = "L'utilisateur actuellement connecté est affiché en haut à droite de chaque page."; +$lang['admin_user_line4'] = "With the password reset button, you can send a user an email containing a link to reset their password. To achieve this, ensure that the email settings in the global options are configured correctly."; $lang['admin_user_list'] = "Liste des utilisateurs"; $lang['admin_user'] = "Utilisateur"; $lang['admin_email'] = "E-mail"; $lang['admin_type'] = "Type"; +$lang['admin_last_login'] = "Last Login"; $lang['admin_options'] = "Options"; $lang['admin_create_user'] = "Création d'un utilisateur"; @@ -25,7 +27,10 @@ $lang['admin_close'] = "Fermer"; $lang['admin_user_accounts'] = "Compte des utilisateurs"; $lang['admin_danger'] = "DANGER!"; $lang['admin_experimental'] = "Expérimental"; +$lang['admin_password_reset'] = "Password Reset"; +$lang['admin_email_settings_incorrect'] = "Email settings are incorrect."; +$lang['admin_password_reset_processed'] = "Password Reset E-Mail sent."; // Contest Menu diff --git a/application/language/french/general_words_lang.php b/application/language/french/general_words_lang.php index 37887ba3..ca5da08f 100644 --- a/application/language/french/general_words_lang.php +++ b/application/language/french/general_words_lang.php @@ -25,6 +25,7 @@ $lang['general_word_count'] = "Nombre"; $lang['general_word_filtering_on'] = "Filtré sur"; $lang['general_word_not_display'] = "Ne pas afficher"; $lang['general_word_icon'] = "Icône"; +$lang['general_word_never'] = "Never"; $lang['general_word_date'] = "Date"; $lang['general_word_startdate'] = "Date début"; diff --git a/application/language/german/admin_lang.php b/application/language/german/admin_lang.php index 683ad29e..113fed3e 100644 --- a/application/language/german/admin_lang.php +++ b/application/language/german/admin_lang.php @@ -5,12 +5,14 @@ defined('BASEPATH') OR exit('Direkter Zugriff auf Skripte ist nicht erlaubt'); $lang['admin_user_line1'] = 'Es muss mindestens ein Benutzer konfiguriert sein, damit Cloudlog funktioniert.'; $lang['admin_user_line2'] = 'Benutzer können verschiedene Rollen zugewiesen bekommen, die ihnen unterschiedliche Rechte geben wie QSOs zum Logbuch hinzuzufügen und die APIs von Cloudlog zu benutzen'; $lang['admin_user_line3'] = 'Der aktuell angemeldete Benutzer wird oben rechts auf jeder Seite angezeigt.'; +$lang['admin_user_line4'] = "Mit dem Passwort Reset Knopf kannst du dem Benutzer eine E-Mail mit einem Passwort-Reset Link zuschicken. Dafür müssen die E-Mail Einstellungen in den globalen Optionen korrekt eingerichtet sein."; $lang['admin_user_list'] = 'Benutzer Liste'; $lang['admin_user'] = 'Benutzer'; $lang['admin_email'] = 'E-Mail'; $lang['admin_type'] = 'Typ'; +$lang['admin_last_login'] = "Letzter Login"; $lang['admin_options'] = 'Optionen'; $lang['admin_create_user'] = 'Benutzer anlegen'; @@ -25,7 +27,10 @@ $lang['admin_close'] = 'Schliessen'; $lang['admin_user_accounts'] = 'Benutzerkonten'; $lang['admin_danger'] = 'ACHTUNG!'; $lang['admin_experimental'] = "Experimentell"; +$lang['admin_password_reset'] = "Passwort zurücksetzen"; +$lang['admin_email_settings_incorrect'] = "E-Mail Einstellungen sind nicht korrekt."; +$lang['admin_password_reset_processed'] = "Password Reset E-Mail verschickt."; // Contest Menu diff --git a/application/language/german/general_words_lang.php b/application/language/german/general_words_lang.php index 3032fbfc..2f986683 100644 --- a/application/language/german/general_words_lang.php +++ b/application/language/german/general_words_lang.php @@ -25,6 +25,7 @@ $lang['general_word_count'] = "Zähler"; $lang['general_word_filtering_on'] = "Filtern auf"; $lang['general_word_not_display'] = "Not display"; $lang['general_word_icon'] = "Icon"; +$lang['general_word_never'] = "Nie"; $lang['general_word_date'] = 'Datum'; $lang['general_word_startdate'] = "Start Datum"; diff --git a/application/language/greek/admin_lang.php b/application/language/greek/admin_lang.php index f045c1a9..2560697f 100644 --- a/application/language/greek/admin_lang.php +++ b/application/language/greek/admin_lang.php @@ -5,12 +5,14 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $lang['admin_user_line1'] = 'Cloudlog needs at least one user configured in order to operate.'; $lang['admin_user_line2'] = 'Users can be assigned roles which give them different permissions, such as adding QSOs to the logbook and accessing Cloudlog APIs.'; $lang['admin_user_line3'] = 'The currently logged-in user is displayed at the upper-right of each page.'; +$lang['admin_user_line4'] = "With the password reset button, you can send a user an email containing a link to reset their password. To achieve this, ensure that the email settings in the global options are configured correctly."; $lang['admin_user_list'] = 'User List'; $lang['admin_user'] = 'User'; $lang['admin_email'] = 'E-mail'; $lang['admin_type'] = 'Type'; +$lang['admin_last_login'] = "Last Login"; $lang['admin_options'] = 'Options'; $lang['admin_create_user'] = 'Create user'; @@ -25,7 +27,10 @@ $lang['admin_close'] = 'Close'; $lang['admin_user_accounts'] = 'User Accounts'; $lang['admin_danger'] = 'DANGER!'; $lang['admin_experimental'] = "Experimental"; +$lang['admin_password_reset'] = "Password Reset"; +$lang['admin_email_settings_incorrect'] = "Email settings are incorrect."; +$lang['admin_password_reset_processed'] = "Password Reset E-Mail sent."; // Contest Menu diff --git a/application/language/greek/general_words_lang.php b/application/language/greek/general_words_lang.php index 32ee11e9..9348a5f0 100644 --- a/application/language/greek/general_words_lang.php +++ b/application/language/greek/general_words_lang.php @@ -25,6 +25,7 @@ $lang['general_word_count'] = "Count"; $lang['general_word_filtering_on'] = "Filtering on"; $lang['general_word_not_display'] = "Not display"; $lang['general_word_icon'] = "Icon"; +$lang['general_word_never'] = "Never"; $lang['general_word_date'] = 'Ημερομηνία'; $lang['general_word_startdate'] = "Start Date"; diff --git a/application/language/italian/admin_lang.php b/application/language/italian/admin_lang.php index f045c1a9..2560697f 100644 --- a/application/language/italian/admin_lang.php +++ b/application/language/italian/admin_lang.php @@ -5,12 +5,14 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $lang['admin_user_line1'] = 'Cloudlog needs at least one user configured in order to operate.'; $lang['admin_user_line2'] = 'Users can be assigned roles which give them different permissions, such as adding QSOs to the logbook and accessing Cloudlog APIs.'; $lang['admin_user_line3'] = 'The currently logged-in user is displayed at the upper-right of each page.'; +$lang['admin_user_line4'] = "With the password reset button, you can send a user an email containing a link to reset their password. To achieve this, ensure that the email settings in the global options are configured correctly."; $lang['admin_user_list'] = 'User List'; $lang['admin_user'] = 'User'; $lang['admin_email'] = 'E-mail'; $lang['admin_type'] = 'Type'; +$lang['admin_last_login'] = "Last Login"; $lang['admin_options'] = 'Options'; $lang['admin_create_user'] = 'Create user'; @@ -25,7 +27,10 @@ $lang['admin_close'] = 'Close'; $lang['admin_user_accounts'] = 'User Accounts'; $lang['admin_danger'] = 'DANGER!'; $lang['admin_experimental'] = "Experimental"; +$lang['admin_password_reset'] = "Password Reset"; +$lang['admin_email_settings_incorrect'] = "Email settings are incorrect."; +$lang['admin_password_reset_processed'] = "Password Reset E-Mail sent."; // Contest Menu diff --git a/application/language/italian/general_words_lang.php b/application/language/italian/general_words_lang.php index 5c3a2527..f618ef6a 100644 --- a/application/language/italian/general_words_lang.php +++ b/application/language/italian/general_words_lang.php @@ -25,6 +25,7 @@ $lang['general_word_count'] = "Count"; $lang['general_word_filtering_on'] = "Filtering on"; $lang['general_word_not_display'] = "Not display"; $lang['general_word_icon'] = "Icon"; +$lang['general_word_never'] = "Never"; $lang['general_word_date'] = 'Data'; $lang['general_word_startdate'] = "Start Date"; diff --git a/application/language/polish/admin_lang.php b/application/language/polish/admin_lang.php index f045c1a9..2560697f 100644 --- a/application/language/polish/admin_lang.php +++ b/application/language/polish/admin_lang.php @@ -5,12 +5,14 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $lang['admin_user_line1'] = 'Cloudlog needs at least one user configured in order to operate.'; $lang['admin_user_line2'] = 'Users can be assigned roles which give them different permissions, such as adding QSOs to the logbook and accessing Cloudlog APIs.'; $lang['admin_user_line3'] = 'The currently logged-in user is displayed at the upper-right of each page.'; +$lang['admin_user_line4'] = "With the password reset button, you can send a user an email containing a link to reset their password. To achieve this, ensure that the email settings in the global options are configured correctly."; $lang['admin_user_list'] = 'User List'; $lang['admin_user'] = 'User'; $lang['admin_email'] = 'E-mail'; $lang['admin_type'] = 'Type'; +$lang['admin_last_login'] = "Last Login"; $lang['admin_options'] = 'Options'; $lang['admin_create_user'] = 'Create user'; @@ -25,7 +27,10 @@ $lang['admin_close'] = 'Close'; $lang['admin_user_accounts'] = 'User Accounts'; $lang['admin_danger'] = 'DANGER!'; $lang['admin_experimental'] = "Experimental"; +$lang['admin_password_reset'] = "Password Reset"; +$lang['admin_email_settings_incorrect'] = "Email settings are incorrect."; +$lang['admin_password_reset_processed'] = "Password Reset E-Mail sent."; // Contest Menu diff --git a/application/language/polish/general_words_lang.php b/application/language/polish/general_words_lang.php index 142db493..bafb4353 100644 --- a/application/language/polish/general_words_lang.php +++ b/application/language/polish/general_words_lang.php @@ -25,6 +25,7 @@ $lang['general_word_count'] = "Count"; $lang['general_word_filtering_on'] = "Filtering on"; $lang['general_word_not_display'] = "Not display"; $lang['general_word_icon'] = "Icon"; +$lang['general_word_never'] = "Never"; $lang['general_word_date'] = 'Data'; $lang['general_word_startdate'] = "Start Date"; diff --git a/application/language/russian/admin_lang.php b/application/language/russian/admin_lang.php index 79440283..2cd36711 100644 --- a/application/language/russian/admin_lang.php +++ b/application/language/russian/admin_lang.php @@ -5,12 +5,14 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $lang['admin_user_line1'] = 'Для работы Cloudlog требуется хотя наличие хотя бы одного пользовательского аккаунта.'; $lang['admin_user_line2'] = 'Пользователям могут быть назначены роли, которые предоставляют им различные права, например, добавление QSO в журнал и доступ к API Cloudlog.'; $lang['admin_user_line3'] = 'Текущий вошедший в систему пользователь отображается в правом верхнем углу каждой страницы.'; +$lang['admin_user_line4'] = "With the password reset button, you can send a user an email containing a link to reset their password. To achieve this, ensure that the email settings in the global options are configured correctly."; $lang['admin_user_list'] = 'Список пользователей'; $lang['admin_user'] = 'Пользователь'; $lang['admin_email'] = 'Емэйл'; $lang['admin_type'] = 'Роль'; +$lang['admin_last_login'] = "Last Login"; $lang['admin_options'] = 'Опции'; $lang['admin_create_user'] = 'Создать пользователя'; @@ -25,7 +27,10 @@ $lang['admin_close'] = 'Close'; $lang['admin_user_accounts'] = 'Аккаунты пользователей'; $lang['admin_danger'] = 'ОПАСНО!'; $lang['admin_experimental'] = "Экспериментально"; +$lang['admin_password_reset'] = "Password Reset"; +$lang['admin_email_settings_incorrect'] = "Email settings are incorrect."; +$lang['admin_password_reset_processed'] = "Password Reset E-Mail sent."; // Contest Menu diff --git a/application/language/russian/general_words_lang.php b/application/language/russian/general_words_lang.php index d0409c41..4e67ae7c 100644 --- a/application/language/russian/general_words_lang.php +++ b/application/language/russian/general_words_lang.php @@ -25,6 +25,7 @@ $lang['general_word_count'] = "Счётчик"; $lang['general_word_filtering_on'] = "Отфильтровано по"; $lang['general_word_not_display'] = "Not display"; $lang['general_word_icon'] = "Icon"; +$lang['general_word_never'] = "Never"; $lang['general_word_date'] = 'Дата'; $lang['general_word_startdate'] = "Дата начала"; diff --git a/application/language/spanish/admin_lang.php b/application/language/spanish/admin_lang.php index f045c1a9..2560697f 100644 --- a/application/language/spanish/admin_lang.php +++ b/application/language/spanish/admin_lang.php @@ -5,12 +5,14 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $lang['admin_user_line1'] = 'Cloudlog needs at least one user configured in order to operate.'; $lang['admin_user_line2'] = 'Users can be assigned roles which give them different permissions, such as adding QSOs to the logbook and accessing Cloudlog APIs.'; $lang['admin_user_line3'] = 'The currently logged-in user is displayed at the upper-right of each page.'; +$lang['admin_user_line4'] = "With the password reset button, you can send a user an email containing a link to reset their password. To achieve this, ensure that the email settings in the global options are configured correctly."; $lang['admin_user_list'] = 'User List'; $lang['admin_user'] = 'User'; $lang['admin_email'] = 'E-mail'; $lang['admin_type'] = 'Type'; +$lang['admin_last_login'] = "Last Login"; $lang['admin_options'] = 'Options'; $lang['admin_create_user'] = 'Create user'; @@ -25,7 +27,10 @@ $lang['admin_close'] = 'Close'; $lang['admin_user_accounts'] = 'User Accounts'; $lang['admin_danger'] = 'DANGER!'; $lang['admin_experimental'] = "Experimental"; +$lang['admin_password_reset'] = "Password Reset"; +$lang['admin_email_settings_incorrect'] = "Email settings are incorrect."; +$lang['admin_password_reset_processed'] = "Password Reset E-Mail sent."; // Contest Menu diff --git a/application/language/spanish/general_words_lang.php b/application/language/spanish/general_words_lang.php index 68f081a2..1a5f1ff9 100644 --- a/application/language/spanish/general_words_lang.php +++ b/application/language/spanish/general_words_lang.php @@ -25,6 +25,7 @@ $lang['general_word_count'] = "Count"; $lang['general_word_filtering_on'] = "Filtering on"; $lang['general_word_not_display'] = "Not display"; $lang['general_word_icon'] = "Icon"; +$lang['general_word_never'] = "Never"; $lang['general_word_date'] = 'Fecha'; $lang['general_word_startdate'] = "Start Date"; diff --git a/application/language/swedish/admin_lang.php b/application/language/swedish/admin_lang.php index ab4babfb..4b5b927b 100644 --- a/application/language/swedish/admin_lang.php +++ b/application/language/swedish/admin_lang.php @@ -5,12 +5,14 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $lang['admin_user_line1'] = 'Cloudlog behöver minst en användare konfigurerad för att fungera.'; $lang['admin_user_line2'] = 'Användare kan tilldelas roller som ger dem olika behörigheter, som att lägga till QSO:er i loggboken och komma åt Cloudlog API:er.'; $lang['admin_user_line3'] = 'Den för närvarande inloggade användaren visas uppe till höger på varje sida.'; +$lang['admin_user_line4'] = "With the password reset button, you can send a user an email containing a link to reset their password. To achieve this, ensure that the email settings in the global options are configured correctly."; $lang['admin_user_list'] = 'Användarlista'; $lang['admin_user'] = 'Användare'; $lang['admin_email'] = 'E-post'; $lang['admin_type'] = 'Typ'; +$lang['admin_last_login'] = "Last Login"; $lang['admin_options'] = 'Alternativ'; $lang['admin_create_user'] = 'Skapa användare'; @@ -25,7 +27,10 @@ $lang['admin_close'] = 'Close'; $lang['admin_user_accounts'] = 'User Accounts'; $lang['admin_danger'] = 'DANGER!'; $lang['admin_experimental'] = "Experimental"; +$lang['admin_password_reset'] = "Password Reset"; +$lang['admin_email_settings_incorrect'] = "Email settings are incorrect."; +$lang['admin_password_reset_processed'] = "Password Reset E-Mail sent."; // Contest Menu diff --git a/application/language/swedish/general_words_lang.php b/application/language/swedish/general_words_lang.php index 0b72fa50..d913f625 100644 --- a/application/language/swedish/general_words_lang.php +++ b/application/language/swedish/general_words_lang.php @@ -25,6 +25,7 @@ $lang['general_word_enabled'] = "Enabled"; $lang['general_word_disabled'] = "Disabled"; $lang['general_word_count'] = "Count"; $lang['general_word_filtering_on'] = "Filtering on"; +$lang['general_word_never'] = "Never"; $lang['general_word_export'] = "Export"; $lang['general_word_import'] = "Import"; $lang['general_word_startdate'] = "Start Date"; diff --git a/application/language/turkish/admin_lang.php b/application/language/turkish/admin_lang.php index 574a8a8a..13890cc9 100644 --- a/application/language/turkish/admin_lang.php +++ b/application/language/turkish/admin_lang.php @@ -5,12 +5,14 @@ defined('BASEPATH') OR exit('Doğrudan komut dosyası erişimine izin verilmez') $lang['admin_user_line1'] = 'Cloudlog needs at least one user configured in order to operate.'; $lang['admin_user_line2'] = 'Users can be assigned roles which give them different permissions, such as adding QSOs to the logbook and accessing Cloudlog APIs.'; $lang['admin_user_line3'] = 'The currently logged-in user is displayed at the upper-right of each page.'; +$lang['admin_user_line4'] = "With the password reset button, you can send a user an email containing a link to reset their password. To achieve this, ensure that the email settings in the global options are configured correctly."; $lang['admin_user_list'] = 'User List'; $lang['admin_user'] = 'User'; $lang['admin_email'] = 'E-mail'; $lang['admin_type'] = 'Type'; +$lang['admin_last_login'] = "Last Login"; $lang['admin_options'] = 'Options'; $lang['admin_create_user'] = 'Create user'; @@ -25,7 +27,10 @@ $lang['admin_close'] = 'Close'; $lang['admin_user_accounts'] = 'User Accounts'; $lang['admin_danger'] = 'DANGER!'; $lang['admin_experimental'] = "Experimental"; +$lang['admin_password_reset'] = "Password Reset"; +$lang['admin_email_settings_incorrect'] = "Email settings are incorrect."; +$lang['admin_password_reset_processed'] = "Password Reset E-Mail sent."; // Contest Menu diff --git a/application/language/turkish/general_words_lang.php b/application/language/turkish/general_words_lang.php index 56be209f..8144d051 100644 --- a/application/language/turkish/general_words_lang.php +++ b/application/language/turkish/general_words_lang.php @@ -25,6 +25,7 @@ $lang['general_word_count'] = "Count"; $lang['general_word_filtering_on'] = "Filtering on"; $lang['general_word_not_display'] = "Not display"; $lang['general_word_icon'] = "Icon"; +$lang['general_word_never'] = "Never"; $lang['general_word_date'] = 'Tarih'; $lang['general_word_startdate'] = "Start Date"; diff --git a/application/migrations/167_add_last_login.php b/application/migrations/167_add_last_login.php new file mode 100644 index 00000000..802b6331 --- /dev/null +++ b/application/migrations/167_add_last_login.php @@ -0,0 +1,24 @@ +db->field_exists('last_login_date', 'users')) { + $fields = array( + 'last_login_date TIMESTAMP NULL DEFAULT NULL AFTER `reset_password_date`', + ); + $this->dbforge->add_column('users', $fields); + } + } + + public function down() + { + $this->dbforge->drop_column('users', 'last_login_date'); + } +} diff --git a/application/models/User_model.php b/application/models/User_model.php index 7a7d5b6e..57c97a05 100644 --- a/application/models/User_model.php +++ b/application/models/User_model.php @@ -423,6 +423,16 @@ class User_Model extends CI_Model { return 0; } + // FUNCTION: set's the last-login timestamp in user table + function set_last_login($user_id) { + $data = array( + 'last_login_date' => date('Y-m-d H:i:s') + ); + + $this->db->where('user_id', $user_id); + $this->db->update('users', $data); + } + // FUNCTION: bool authorize($level) // Checks a user's level of access against the given $level function authorize($level) { diff --git a/application/views/email/admin_reset_password.php b/application/views/email/admin_reset_password.php new file mode 100644 index 00000000..954b1c73 --- /dev/null +++ b/application/views/email/admin_reset_password.php @@ -0,0 +1,15 @@ +Hello + + +An admin initiated a password reset for your Cloudlog account. + +Your username is: + + +Click here to reset your password: + + +If you didn't request any password reset, just ignore this email and talk to an admin of your Cloudlog instance. + +Regards, +Cloudlog diff --git a/application/views/user/main.php b/application/views/user/main.php index 8dc9ddd2..b06344a0 100644 --- a/application/views/user/main.php +++ b/application/views/user/main.php @@ -1,63 +1,98 @@
-
+
-

+

-session->flashdata('notice')) { ?> + session->flashdata('notice')) { ?> - + -
-
- -
-
-

-

-

-
- - - - - - - - - - + session->flashdata('success')) { ?> + + - + + session->flashdata('danger')) { ?> + + + + + +
+
+ +
+
+

+

+

+

+

+ +
+
+ + + + + + + + + + + + + - $i = 0; - foreach ($results->result() as $row) { ?> - '; ?> - - - - - - - -
user_id; ?>">user_name; ?>user_email; ?>config->item('auth_level'); echo $l[$row->user_type]; ?> - user_id; ?>" class="btn btn-outline-primary btn-sm"> user_id) { - echo "user_id . " class=\"btn btn-danger btn-sm\"> ".lang('admin_delete').""; - } - ?> -
+ + $i = 0; + foreach ($results->result() as $row) { ?> + '; ?> + user_id; ?>">user_name; ?> + user_callsign; ?> + user_email; ?> + config->item('auth_level'); + echo $l[$row->user_type]; ?> + last_login_date != null) { // if the user never logged in before the value is null. We can show "never" then. + echo $row->last_login_date; + } else { + echo lang('general_word_never'); + }?> + + user_id; ?>" class="btn btn-outline-primary btn-sm"> + + user_id) { + echo "user_id . " class=\"btn btn-primary btn-sm ms-1\">"; + } + ?> + + user_id) { + echo "user_id . " class=\"btn btn-danger btn-sm\">"; + } + ?> + + + + + +
+ +
-

- -

-
- - - - + \ No newline at end of file