public static function Utilities::saml_resend_otp in SAML SP 2.0 Single Sign On (SSO) - SAML Service Provider 8
2 calls to Utilities::saml_resend_otp()
File
- src/
Utilities.php, line 809
Class
- Utilities
- This file is part of miniOrange SAML plugin.
Namespace
Drupal\miniorange_samlCode
public static function saml_resend_otp($called_from_popup = false) {
$db_edit = \Drupal::configFactory()
->getEditable('miniorange_saml.settings');
$db_edit
->clear('miniorange_saml_tx_id')
->save();
$username = \Drupal::config('miniorange_saml.settings')
->get('miniorange_saml_customer_admin_email');
$phone = \Drupal::config('miniorange_saml.settings')
->get('miniorange_saml_customer_admin_phone');
$customer_config = new MiniorangeSAMLCustomer($username, $phone, NULL, NULL);
$send_otp_response = json_decode($customer_config
->sendOtp());
if ($send_otp_response->status == 'SUCCESS') {
// Store txID.
$db_edit
->set('miniorange_saml_tx_id', $send_otp_response->txId)
->save();
$db_edit
->set('miniorange_saml_status', 'VALIDATE_OTP')
->save();
if ($called_from_popup == true) {
miniorange_saml_sp_registration::miniorange_otp(false, true, false);
}
else {
\Drupal::messenger()
->addMessage(t('Verify email address by entering the passcode sent to @username', array(
'@username' => $username,
)));
}
}
else {
if ($called_from_popup == true) {
miniorange_saml_sp_registration::miniorange_otp(false, false, true);
}
else {
\Drupal::messenger()
->addMessage(t('An error has been occured. Please try after some time'), 'error');
}
}
}