Yii 2 Oracle Login
Login using oracle database usename, (*1)
Installation
The preferred way to install this extension is through composer., (*2)
Either run, (*3)
php composer.phar require --prefer-dist apaoww/yii2-oracle-login "dev-master"
or add, (*4)
"apaoww/yii2-oracle-login": "dev-master"
to the require section of your composer.json
file., (*5)
Usage
Once the extension is installed, simply use it in your code by :, (*6)
'oracle_id_username', "password" => "password",
"dsn" => '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SID=xe)))']); ?>
This could be use on Login model to validate the password for example:, (*7)
public function validatePassword($attribute, $params)
{
$dsn = $this->getDsn();
if (!$this->hasErrors()) {
$oracle = OracleLogin::widget(["username" => $this->username, "password" => $this->password,
"dsn" => $dsn['tns']]);
if(!$oracle){
$this->addError($attribute, 'Incorrect username or password.');
}
}
}