Skip to content
This repository has been archived by the owner on Feb 15, 2025. It is now read-only.

Commit

Permalink
Merge branch 'release-2.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasLiampotis committed May 24, 2023
2 parents cb75c36 + c3f7a5d commit e4ceca5
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 52 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion dictionaries/noty.definition.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a href=\"mailto:[email protected]\">support</a> 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 <a href=\"mailto:[email protected]\">support</a> 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 <a href=\"mailto:[email protected]\">support</a> 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"
}
Expand Down
118 changes: 67 additions & 51 deletions lib/Auth/Process/COmanageDbClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit e4ceca5

Please sign in to comment.