diff --git a/CHANGELOG.md b/CHANGELOG.md index 37bd6ee..ed069d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [v2.8.0] - 2023-05-24 + +# Added + +- New error page for handling registered identifiers in an error state + ## [v2.7.0] - 2022-12-01 # Added diff --git a/dictionaries/noty.definition.json b/dictionaries/noty.definition.json index 4eacd00..9d93d00 100644 --- a/dictionaries/noty.definition.json +++ b/dictionaries/noty.definition.json @@ -51,11 +51,17 @@ "en": "Please verify your email address by clicking the link in the email we sent you" }, "user_suspended": { - "en": "Your identity (%ORGID%) has been suspended. Please contact our support and make sure to include the error message above" + "en": "There is a problem with your identifier (%ORGID%). Please get in touch with our support team at support and include the error message shown above. We apologise for any inconvenience caused and will help you resolve this issue as quickly as possible." }, "user_suspended_title": { "en": "Identity suspended" }, + "user_error": { + "en": "Your identity (%ORGID%) is in error state. Please contact our support and make sure to include the error message above" + }, + "user_error_title": { + "en": "Sorry, we were not able to log you in" + }, "yes": { "en": "Resend Verification Email" } diff --git a/lib/Auth/Process/COmanageDbClient.php b/lib/Auth/Process/COmanageDbClient.php index f553887..266677f 100644 --- a/lib/Auth/Process/COmanageDbClient.php +++ b/lib/Auth/Process/COmanageDbClient.php @@ -332,56 +332,7 @@ public function process(&$state) if (empty($basicInfo['id']) // User is NOT present in the Registry OR || empty($basicInfo['status']) // User has no status in the Registry OR - || ($basicInfo['status'] !== StatusEnum::Active // (User is NOT ACTIVE in the Registry AND - && $basicInfo['status'] !== StatusEnum::GracePeriod)) { // User is NOT in GRACE PERIOD in the Registry) - // XXX User is Suspended - if ($basicInfo['status'] === StatusEnum::Suspended) { // User is SUSPENDED - // Redirect to User notification - $pt_noty = [ - 'level' => 'error', - 'description' => ['user_suspended' => [ - '%ORGID%' => $orgId, - ]], - 'status' => 'user_suspended_title', // This is a dictionary key - 'yes_btn_show' => false, - ]; - $this->showNoty($pt_noty, $state); - } - // XXX Petition in Pending Confirmation - if ($basicInfo['status'] === StatusEnum::PendingConfirmation) { // User is PENDING CONFIRMATION - // Get Petition Id - $petition_cfg = [ - 'enrollee_co_person_id' => (int)$basicInfo['id'], - 'petition_status' => $basicInfo['status'], - 'orgIdentifier' => $state['Attributes'][$this->userIdAttribute][0], - 'co_id' => $this->coId, - ]; - $petition_handler = new Enrollment\PetitionHandler($petition_cfg); - $petition = $petition_handler->getPetitionFromPersonIdPetStatus(); - $endpoint = str_replace('%id%', - $petition[0]['petition_id'], - EndpointCmgEnum::ConfirmationEmailResend); - $state['rciamAttributes']['comanage_api_user'] = [ - 'username' => $this->comanage_api_username, - 'password' => $this->comanage_api_password, - ]; - if(!empty($petition)) { - // Get petition id and redirect to email view - $pt_noty = [ - 'level' => $petition_handler->getBannerClass(), - 'description' => $petition_handler->getUserNotify(), - 'title' => 'resend_confirmation_email', - //'status' => 'account_pending_confirmation', // This is a dictionary key - 'icon' => 'email.gif', - 'yes_btn_show' => true, - 'form_fields' => [ - 'send_endpoint' => $endpoint, - 'mail' => $petition[0]['mail'], - ], - ]; - $this->showNoty($pt_noty, $state); - } - } + ) { // XXX User is eligible to proceed to service $state['UserID'] = $orgId; @@ -418,7 +369,72 @@ public function process(&$state) } $this->_redirect($basicInfo, $state, $params); } - // Record the login + + // XXX User is Suspended + if ($basicInfo['status'] === StatusEnum::Suspended) { // User is SUSPENDED + // Redirect to User notification + $pt_noty = [ + 'level' => 'error', + 'description' => ['user_suspended' => [ + '%ORGID%' => $orgId, + ]], + 'status' => 'user_suspended_title', // This is a dictionary key + 'yes_btn_show' => false, + ]; + $this->showNoty($pt_noty, $state); + } + // XXX Petition in Pending Confirmation + if ($basicInfo['status'] === StatusEnum::PendingConfirmation) { // User is PENDING CONFIRMATION + // Get Petition Id + $petition_cfg = [ + 'enrollee_co_person_id' => (int)$basicInfo['id'], + 'petition_status' => $basicInfo['status'], + 'orgIdentifier' => $state['Attributes'][$this->userIdAttribute][0], + 'co_id' => $this->coId, + ]; + $petition_handler = new Enrollment\PetitionHandler($petition_cfg); + $petition = $petition_handler->getPetitionFromPersonIdPetStatus(); + $endpoint = str_replace('%id%', + $petition[0]['petition_id'], + EndpointCmgEnum::ConfirmationEmailResend); + $state['rciamAttributes']['comanage_api_user'] = [ + 'username' => $this->comanage_api_username, + 'password' => $this->comanage_api_password, + ]; + if(!empty($petition)) { + // Get petition id and redirect to email view + $pt_noty = [ + 'level' => $petition_handler->getBannerClass(), + 'description' => $petition_handler->getUserNotify(), + 'title' => 'resend_confirmation_email', + //'status' => 'account_pending_confirmation', // This is a dictionary key + 'icon' => 'email.gif', + 'yes_btn_show' => true, + 'form_fields' => [ + 'send_endpoint' => $endpoint, + 'mail' => $petition[0]['mail'], + ], + ]; + $this->showNoty($pt_noty, $state); + } + } + + + if($basicInfo['status'] !== StatusEnum::Active + && $basicInfo['status'] !== StatusEnum::GracePeriod) { + // Redirect to User notification + $pt_noty = [ + 'level' => 'error', + 'description' => ['user_error' => [ + '%ORGID%' => $orgId, + ]], + 'status' => 'user_error_title', // This is a dictionary key + 'yes_btn_show' => false, + ]; + $this->showNoty($pt_noty, $state); + } + + // Record the login $auth_event = new User\AuthenticationEventHandler(); $auth_event->recordAuthenticationEvent($state['Attributes'][$this->userIdAttribute][0]); $this->orgIdentity->setOrgIdentityIdentifier($orgId);