My site sends email with a link to the user if the CO is finalized.
If the user is not signed in the user must first go to the login page, and only if user is signed in then they are redirected to the url.
Now if user is signed in they go to directly to the url, but not signed in go to log in page, he can log in but he is not direct to the url can anyone help with that?
this page url with some parameters is send to the user to as link
<?php
if(isset($_SESSION['ssid']) && $_SESSION['ssid'] == session_id() )
{
// do you staff, after login confirm
}
else {
// redirect to loginPage.php
}
use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\ActiveForm;
use yii\widgets\Pjax;
use kartik\grid\GridView;
use backend\models\Item;
use backend\models\Respond;
use kartik\time\TimePicker;
use backend\models\RespondItem;
use backend\models\RequestItem;
use backend\models\DistributorHasItemCode;
?>
<?php
$check = null;
$checknow = null;
$checkfield = null;
$today = date('Y-m-d');
$date = date("Y-m-d H:i:s", time());
$date1 = new DateTime($date);
$date2 = new DateTime($model->end_date.' '.$model->end_time);
if(empty($model->end_date))
{
$model->end_date = $today;
}
if (Yii::$app->user->identity->ref_table =="sales_rep")
{
$sales_rep = Yii::$app->user->identity->ref_id;
$respond = Respond::find()->where(['sales_rep_id'=>$sales_rep,'customer_order_request_id'=>$model->id])->one();
if (!empty($respond) && $respond->status == 'Finalized and customer Notified' || $date1>=$date2 )
{
$check = "disabled='disabled'";
}
if ($model->status == 'Finalized and Sales Rep Notified') {
$checknow = "disabled='disabled'";
}
}else {
if ($model->status == 'Finalized and Sales Rep Notified') {
$check = "disabled='disabled'";
}
}
?>
<?= Yii::$app->session->getFlash('success') ?>
<div class="customer-order-request-form">
<?php $form = ActiveForm::begin(['id'=>'cor']); ?>
<fieldset <?= $check?> >
<fieldset <?= $checknow?> >
<div class="row">
<div class="col-lg-4">
<?= $form->field($model, 'code')->textInput(['maxlength' => 10,'readonly'=>TRUE]) ?>
</div>
<div class="col-lg-2" disabled>
<?= $form->field($model, 'end_date')->widget(\yii\jui\DatePicker::classname(), [
'dateFormat' => 'yyyy-MM-dd',
'clientOptions'=> ['defaultDate'=>$today,'minDate' =>$today,],
'options'=>[
'class'=> 'form-control',
],
])
?>
</div>
<div class="col-lg-2">
<?= $form->field($model, 'end_time')->widget(TimePicker::classname(), [
'pluginOptions' =>
[
'showMeridian' => true,
],
]);
?>
</div>
<div class="col-lg-4">
<?= $form->field($model, 'status')->textInput(['readonly'=>TRUE]) ?>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<?= $form->field($model, 'description')->textarea(['rows'=>3]);?>
</div>
</div>
</fieldset>
<div class="form-group">
<?= Html::submitButton((Yii::$app->user->identity->ref_table =="sales_rep")?'Save':'Update', ['class' =>'btn btn-success']) ?>
<?= Html::button((Yii::$app->user->identity->ref_table =="sales_rep")?'Finalize & Notify Customer':'Finalize & Notify Sales Reps', ['class' => 'btn btn-primary finalize']) ?>
</div>
</fieldset>
<?php ActiveForm::end(); ?>