otp password cobination
This commit is contained in:
parent
00a779266d
commit
84c0305438
@ -121,7 +121,9 @@ class Login_Controller extends REST_Controller {
|
|||||||
*/
|
*/
|
||||||
public function checkMobileNumber_post(){
|
public function checkMobileNumber_post(){
|
||||||
$studentnum = $this->post('mobilenum');
|
$studentnum = $this->post('mobilenum');
|
||||||
$getstudent = $this->login_model->checkstudnetnumber($studentnum);
|
$otpcheck = $this->post('otpcheck');
|
||||||
|
$password = $this->post('pwd');
|
||||||
|
$getstudent = $this->login_model->checkstudnetnumber($studentnum,$otpcheck,$password);
|
||||||
if ($getstudent)
|
if ($getstudent)
|
||||||
{
|
{
|
||||||
$getstudent['status'] = REST_Controller::HTTP_OK;
|
$getstudent['status'] = REST_Controller::HTTP_OK;
|
||||||
|
|||||||
@ -140,7 +140,7 @@ class Login_model extends CI_Model
|
|||||||
//echo 'NO_SUPER_ADMIN';die();
|
//echo 'NO_SUPER_ADMIN';die();
|
||||||
if ($mobile == $loginDetails->MobileNumber || strtoupper($mobile) == strtoupper($loginDetails->StaffID))
|
if ($mobile == $loginDetails->MobileNumber || strtoupper($mobile) == strtoupper($loginDetails->StaffID))
|
||||||
{
|
{
|
||||||
// echo 'no _if';die();
|
//echo 'no _if';die();
|
||||||
// print_r($loginDetails);die();
|
// print_r($loginDetails);die();
|
||||||
|
|
||||||
$this->db->select('LO.MobileNumber, LO.ListCode, LO.ID, ST.IsActive,LO.StaffID,ST.BranchCode,SC.CallModuleAccess,SC.FinanceModuleAccess');
|
$this->db->select('LO.MobileNumber, LO.ListCode, LO.ID, ST.IsActive,LO.StaffID,ST.BranchCode,SC.CallModuleAccess,SC.FinanceModuleAccess');
|
||||||
@ -312,7 +312,7 @@ class Login_model extends CI_Model
|
|||||||
* Studnet Check function*
|
* Studnet Check function*
|
||||||
* created_by : sriram
|
* created_by : sriram
|
||||||
*/
|
*/
|
||||||
public function checkstudnetnumber($mobile){
|
public function checkstudnetnumber($mobile,$otpcheck,$password){
|
||||||
|
|
||||||
$this->db->select('t1.MobileNumber, t1.Password,t1.ListCode');
|
$this->db->select('t1.MobileNumber, t1.Password,t1.ListCode');
|
||||||
$this->db->from('' . LOGIN . ' as t1');
|
$this->db->from('' . LOGIN . ' as t1');
|
||||||
@ -373,19 +373,39 @@ class Login_model extends CI_Model
|
|||||||
else if(($loginDetails->ListCode == ADMIN)||($loginDetails->ListCode == EMPLOYEE)||(($loginDetails->ListCode == TRAINEE)))
|
else if(($loginDetails->ListCode == ADMIN)||($loginDetails->ListCode == EMPLOYEE)||(($loginDetails->ListCode == TRAINEE)))
|
||||||
{
|
{
|
||||||
|
|
||||||
$result['loginstudent'] = true;
|
$result['loginstudent'] = false;
|
||||||
|
|
||||||
|
$result['loginemployee'] = true;
|
||||||
|
|
||||||
|
if($otpcheck == 1)
|
||||||
|
{
|
||||||
|
$adminpwd= md5($password);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$this->db->select('LO.MobileNumber, LO.ListCode, LO.ID,ST.BranchCode, ST.IsActive,LO.StaffID,ST.MobileNumber as Mobile');
|
$this->db->select('LO.MobileNumber, LO.ListCode, LO.ID,ST.BranchCode, ST.IsActive,LO.StaffID,ST.MobileNumber as Mobile');
|
||||||
$this->db->from('' . LOGIN . ' as LO');
|
$this->db->from('' . LOGIN . ' as LO');
|
||||||
$this->db->join('' . STAFF . ' as ST', 'LO.StaffID = ST.StaffID');
|
$this->db->join('' . STAFF . ' as ST', 'LO.StaffID = ST.StaffID');
|
||||||
$this->db->where('LO.MobileNumber', $mobile);
|
$this->db->where('LO.MobileNumber', $mobile);
|
||||||
|
|
||||||
|
if($otpcheck == 1)
|
||||||
|
{
|
||||||
|
$this->db->where('LO.Password', $adminpwd);
|
||||||
|
}
|
||||||
$this->db->where('ST.IsActive', 1);
|
$this->db->where('ST.IsActive', 1);
|
||||||
$responseDetails = $this->db->get()->first_row();
|
$responseDetails = $this->db->get()->first_row();
|
||||||
|
|
||||||
//print_r($responseDetails);die();
|
|
||||||
|
if($otpcheck == 1)
|
||||||
|
{
|
||||||
|
|
||||||
|
//print_r($this->db->last_query());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(!empty($responseDetails))
|
||||||
|
{
|
||||||
if($responseDetails->IsActive ==1){
|
if($responseDetails->IsActive ==1){
|
||||||
$string2 = str_shuffle('1234567890');
|
$string2 = str_shuffle('1234567890');
|
||||||
$otp = substr($string2,0,6);
|
$otp = substr($string2,0,6);
|
||||||
@ -402,11 +422,20 @@ class Login_model extends CI_Model
|
|||||||
|
|
||||||
// $query =1;
|
// $query =1;
|
||||||
if($query == 1){
|
if($query == 1){
|
||||||
$sms = $this->smssend($mobileno,$otp);
|
|
||||||
|
|
||||||
$result['checkstudent'] = true;
|
if($otpcheck == 1)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
$sms = $this->smssend($mobileno,$otp);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result['checkemp'] = true;
|
||||||
|
$result['loginstudent'] = false;
|
||||||
|
|
||||||
|
$result['loginemployee'] = true;
|
||||||
}else{
|
}else{
|
||||||
$result['checkstudent'] = false;
|
$result['checkemp'] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -414,7 +443,13 @@ class Login_model extends CI_Model
|
|||||||
$result['loginStatus'] = false;
|
$result['loginStatus'] = false;
|
||||||
$result['message'] = "Your login is de-activated.";
|
$result['message'] = "Your login is de-activated.";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
$result['loginStatus'] = false;
|
||||||
|
$result['loginemployee'] = false;
|
||||||
|
$result['message'] = "Your login is de-activated.";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -438,7 +473,7 @@ class Login_model extends CI_Model
|
|||||||
}
|
}
|
||||||
public function smssend($mobile,$OTP) {
|
public function smssend($mobile,$OTP) {
|
||||||
|
|
||||||
|
//echo $mobile;
|
||||||
|
|
||||||
$message ="Your One Time Password to Login to apollodec.com is $OTP. This is valid for 10 minutes.";
|
$message ="Your One Time Password to Login to apollodec.com is $OTP. This is valid for 10 minutes.";
|
||||||
$mobile = "91$mobile";
|
$mobile = "91$mobile";
|
||||||
|
|||||||
@ -25,6 +25,8 @@ app.controller('loginCtrl', ["$scope", "$http", "API_POINTS", "$state", '$rootSc
|
|||||||
|
|
||||||
$scope.form = {
|
$scope.form = {
|
||||||
submit: function (form) {
|
submit: function (form) {
|
||||||
|
|
||||||
|
// alert('in');
|
||||||
var firstError = null;
|
var firstError = null;
|
||||||
if (form.$invalid) {
|
if (form.$invalid) {
|
||||||
var field = null, firstError = null;
|
var field = null, firstError = null;
|
||||||
@ -94,7 +96,7 @@ app.controller('loginCtrl', ["$scope", "$http", "API_POINTS", "$state", '$rootSc
|
|||||||
// alert(response.data.message);
|
// alert(response.data.message);
|
||||||
swal("Warning!", response.data.message, "warning");
|
swal("Warning!", response.data.message, "warning");
|
||||||
$scope.show = true;
|
$scope.show = true;
|
||||||
$(".alert").delay(200).addClass("in").fadeOut(3500);
|
//$(".alert").delay(200).addClass("in").fadeOut(3500);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -133,9 +135,13 @@ app.controller('loginCtrl', ["$scope", "$http", "API_POINTS", "$state", '$rootSc
|
|||||||
* Checkstudent change function *
|
* Checkstudent change function *
|
||||||
* created_by : sriram
|
* created_by : sriram
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$scope.Empcheck = false;
|
||||||
$scope.checkMobileNumber = function (MobileNumber) {
|
$scope.checkMobileNumber = function (MobileNumber) {
|
||||||
//alert($scope.myModel.userMobile);
|
//alert($scope.myModel.userMobile);
|
||||||
// var studentNumber = $scope.myModel.userMobile;
|
// var studentNumber = $scope.myModel.userMobile;
|
||||||
|
|
||||||
|
var otpcheck= MobileNumber;
|
||||||
if($scope.myModel.userMobile !=''){
|
if($scope.myModel.userMobile !=''){
|
||||||
// swal({
|
// swal({
|
||||||
// title:"Please Wait..",
|
// title:"Please Wait..",
|
||||||
@ -147,27 +153,50 @@ app.controller('loginCtrl', ["$scope", "$http", "API_POINTS", "$state", '$rootSc
|
|||||||
url:apiPoint.url + 'checkmobilenumber',
|
url:apiPoint.url + 'checkmobilenumber',
|
||||||
|
|
||||||
header:{'Content-Type':'application/json'},
|
header:{'Content-Type':'application/json'},
|
||||||
data:{mobilenum:$scope.myModel.userMobile}
|
data:{mobilenum:$scope.myModel.userMobile,otpcheck:otpcheck,pwd:$scope.myModel.passwordemp}
|
||||||
};
|
};
|
||||||
$http(req).then(function(response){
|
$http(req).then(function(response){
|
||||||
//console.log(response);
|
//console.log(response);
|
||||||
swal.close();
|
swal.close();
|
||||||
if(response.data.loginstudent ==true){
|
if((response.data.loginstudent ==true)||(response.data.loginemployee ==true)){
|
||||||
if(response.data.checkstudent == true){
|
|
||||||
|
console.log('if');
|
||||||
|
if(response.data.checkstudent == true)
|
||||||
|
{
|
||||||
$scope.typeInput = 'text';
|
$scope.typeInput = 'text';
|
||||||
$scope.place = 'OTP';
|
$scope.place = 'OTP';
|
||||||
$scope.icon = 'fa fa-key';
|
$scope.icon = 'fa fa-key';
|
||||||
$scope.info = true;
|
$scope.info = true;
|
||||||
}else{
|
}
|
||||||
|
|
||||||
|
else if(response.data.checkemp== true)
|
||||||
|
{
|
||||||
|
console.log('in');
|
||||||
|
|
||||||
|
$scope.Empcheck = true;
|
||||||
|
$scope.typeInput = 'text';
|
||||||
|
$scope.place = 'OTP';
|
||||||
|
$scope.icon = 'fa fa-key';
|
||||||
|
$scope.info = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
swal("Warning!", response.data.message, "warning");
|
swal("Warning!", response.data.message, "warning");
|
||||||
$scope.show = true;
|
$scope.show = true;
|
||||||
$(".alert").delay(200).addClass("in").fadeOut(3500);
|
// $(".alert").delay(200).addClass("in").fadeOut(3500);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
$scope.typeInput = 'password';
|
$scope.typeInput = 'password';
|
||||||
$scope.place = 'password';
|
$scope.place = 'password';
|
||||||
$scope.icon = 'fa fa-lock';
|
$scope.icon = 'fa fa-lock';
|
||||||
$scope.info = false;
|
$scope.info = false;
|
||||||
|
|
||||||
|
swal("Warning!", response.data.message, "warning");
|
||||||
|
// $scope.show = true;
|
||||||
|
// $(".alert").delay(200).addClass("in").fadeOut(3500);
|
||||||
|
|
||||||
|
//alert(response.data.message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -379,6 +379,34 @@
|
|||||||
<span class="error text-small block" ng-if="Form.mobilenumber.$error.maxlength || Form.mobilenumber.$error.minlength || Form.mobilenumber.$error.pattern">Enter a valid mobile number / Employee Id</span>
|
<span class="error text-small block" ng-if="Form.mobilenumber.$error.maxlength || Form.mobilenumber.$error.minlength || Form.mobilenumber.$error.pattern">Enter a valid mobile number / Employee Id</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="form-group" ng-class="{'has-error':Form.passwordemp.$dirty && Form.passwordemp.$invalid, 'has-success':Form.passwordemp.$valid}" ng-if="Empcheck">
|
||||||
|
|
||||||
|
<span class="input-icon">
|
||||||
|
<input type="password" id="inputPassword4" placeholder="password" class="form-control heighLight underline" name="passwordemp" ng-model="myModel.passwordemp"
|
||||||
|
ng-minlength="6" required/>
|
||||||
|
<i style="color: black;" class="fa fa-lock"></i>
|
||||||
|
<span class="error text-small block" ng-if="Form.passwordemp.$dirty && Form.passwordemp.$invalid"> Password Required</span></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group" ng-if="Empcheck">
|
||||||
|
|
||||||
|
<button class="btn btn-success btn" ng-click="checkMobileNumber(1);" tabindex="8">
|
||||||
|
Generate OTP
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group" ng-class="{'has-error':Form.password.$dirty && Form.password.$invalid, 'has-success':Form.password.$valid}">
|
<div class="form-group" ng-class="{'has-error':Form.password.$dirty && Form.password.$invalid, 'has-success':Form.password.$valid}">
|
||||||
|
|
||||||
<span class="input-icon">
|
<span class="input-icon">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user