diff --git a/Apollo/api/application/config/routes.php b/Apollo/api/application/config/routes.php
index 8101a656..a91d9736 100755
--- a/Apollo/api/application/config/routes.php
+++ b/Apollo/api/application/config/routes.php
@@ -121,6 +121,8 @@ $route['updateActivityDetails'] = 'University_Controller/updateActivityDetails';
$route['changePassword'] = 'Login_Controller/changePassword';
+$route['changePasswordLogin'] = 'Login_Controller/changePasswordLogin';
+
// student
$route['insertStudent'] = 'Student_Controller/addStudent';
$route['getStudentUniversity'] = 'Student_Controller/getStudentUniversity';
diff --git a/Apollo/api/application/controllers/Login_Controller.php b/Apollo/api/application/controllers/Login_Controller.php
index af0db637..ea1ceca3 100755
--- a/Apollo/api/application/controllers/Login_Controller.php
+++ b/Apollo/api/application/controllers/Login_Controller.php
@@ -162,10 +162,37 @@ class Login_Controller extends REST_Controller {
'message' => 'No users were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
- }
+ }
+ }
+ public function changePasswordLogin_post()
+ {
+ $updata['emp_Ph'] = $this->post('UserId');
+ $updata['oldPassword'] = $this->post('oldPassword');
+ $updata['newPassword'] = $this->post('newPassword');
+ $date = date('Y-m-d');
+ $updata['Password_Date'] = $date;
+ $updatepassword = $this->login_model->UpdateLoginPassword($updata);
+ if ($updatepassword)
+ {
+ $updatepassword['status'] = REST_Controller::HTTP_OK;
+ // Set the response and exit
+ $this->response($updatepassword, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
+ }
+ else
+ {
+ // Set the response and exit
+ $this->response([
+ 'message' => 'No users were found',
+ 'status' => REST_Controller::HTTP_NOT_FOUND
+ ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
+ }
+
+
+
+ //print_r($updata);
}
}
\ No newline at end of file
diff --git a/Apollo/api/application/models/Employee_model.php b/Apollo/api/application/models/Employee_model.php
index 9e4faa03..892efb82 100755
--- a/Apollo/api/application/models/Employee_model.php
+++ b/Apollo/api/application/models/Employee_model.php
@@ -370,6 +370,9 @@ class Employee_model extends CI_Model
public function add_employee($empArr, $createdBy, $imageName, $imageSource, $imageSize)
{
//print_r($empArr);exit();
+
+ $time = date('Y-m-d');
+ $dateTime = $time;
if( $imageSource == '') { // add employee without image
$imageNameDb = 'default.jpeg';
$empArr['ProfilePicPath'] = "employee/".$imageNameDb;
@@ -393,6 +396,7 @@ class Employee_model extends CI_Model
$loginArr['EmailId'] = $empArr['EmailID'];
$loginArr['IsActive'] = $empArr['IsActive'];
$loginArr['CreatedBy'] = $createdBy;
+ $loginArr['Password_Date']= $dateTime;
$loginArr['Password'] = ENCR_PASSWORD;
$this->db->insert(LOGIN, $loginArr);
if ($this->db->affected_rows() == '1') {
diff --git a/Apollo/api/application/models/Login_model.php b/Apollo/api/application/models/Login_model.php
index 19f895f3..c6ac459a 100755
--- a/Apollo/api/application/models/Login_model.php
+++ b/Apollo/api/application/models/Login_model.php
@@ -150,7 +150,44 @@ class Login_model extends CI_Model
$this->db->where('IsActive','1');
$details = $this->db->get()->first_row();
- //print_r($details);
+ // print_r($details);die();
+
+ $time = date('Y-m-d');
+ $dateTime = $time;
+
+ $password_date = new DateTime($details->Password_Date);
+ $today_date = new DateTime($dateTime);
+ $diff=date_diff($password_date,$today_date);
+
+ // echo $diff->format("%R%a days");
+
+ // $datediff = $diff->format("%d days");
+
+ //echo $datediff;
+
+
+ $start = strtotime($details->Password_Date);
+ $end = strtotime($dateTime);
+
+ $days_between = ceil(abs($end - $start) / 86400);
+
+
+
+ if(!empty($details))
+ {
+
+ if($days_between>'+30')
+ {
+
+ $result['loginStatus'] =false;
+ $result['passwordStatus'] =false;
+ $result['message'] = "Please Change the Password !!";
+ }
+
+ else
+ {
+ // echo 'invalid';
+
if($details)
{
@@ -192,6 +229,10 @@ class Login_model extends CI_Model
$result['loginStatus'] =true;
}
+
+ }
+
+ }
else
{
$result['pwdcheck']=false;
@@ -205,6 +246,8 @@ class Login_model extends CI_Model
+
+
/// die();
// print_r($loginDetails);die();
@@ -276,6 +319,40 @@ class Login_model extends CI_Model
if ($password == $loginDetails->Password) {
/// echo 'SUPER_ADMIN';die();
+
+
+ $this->db->select('*');
+ $this->db->from('T_Login');
+ $this->db->where('MobileNumber',$mobile);
+ $this->db->where('Password',$password);
+ $this->db->where('IsActive','1');
+ $details = $this->db->get()->first_row();
+
+ $time = date('Y-m-d');
+ $dateTime = $time;
+
+ $password_date = new DateTime($details->Password_Date);
+ $today_date = new DateTime($dateTime);
+ $diff=date_diff($password_date,$today_date);
+ $start = strtotime($details->Password_Date);
+ $end = strtotime($dateTime);
+
+ $days_between = ceil(abs($end - $start) / 86400);
+
+ if($days_between>'+30')
+ {
+
+ $result['loginStatus'] =false;
+ $result['passwordStatus'] =false;
+ $result['message'] = "Please Change the Password !!";
+ }
+
+
+ else
+ {
+
+
+
$superadminpwd= md5($password);
$this->db->select('t1.MobileNumber, t1.ListCode, t1.ID, t2.BranchCode, t2.FinanceModuleAccess,t2.CallModuleAccess');
@@ -325,6 +402,19 @@ class Login_model extends CI_Model
}
+ }
+
+
+
+
+
+
+
+
+
+
+
+
else
{
$result['loginStatus'] = false;
@@ -442,7 +532,11 @@ class Login_model extends CI_Model
$this->db->where('ID', $userId);
$loginDetails = $this->db->get()->first_row();
if ($loginDetails->Password == $oldPassword) {
- $sql = "UPDATE ".LOGIN." SET Password='$newPassword', UpdatedBy='$userId', UpdatedOn='$updateOn' WHERE ID='$userId'";
+
+ $date = date('Y-m-d');
+ $Password_Date = $date;
+
+ $sql = "UPDATE ".LOGIN." SET Password='$newPassword', UpdatedBy='$userId', UpdatedOn='$updateOn',Password_Date='$Password_Date' WHERE ID='$userId'";
if($this->db->query($sql) == '1'){
$result['changePassStatus'] = true;
$result['message'] = "Your Password Successfully changed !!";
@@ -700,6 +794,47 @@ $this->db->insert_batch('T_BroadcastStatus', $data);
+ public function UpdateLoginPassword($updata)
+ {
+ $this->db->select('*');
+ $this->db->from('T_Login');
+ $this->db->where('MobileNumber',$updata['emp_Ph']);
+ $this->db->where('Password',$updata['oldPassword']);
+ $searchDetails = $this->db->get();
+
+ $details = $searchDetails->result();
+
+ //print_r($details);
+
+ if($details)
+ {
+
+ //$data['MobileNumber'] = $updata['emp_Ph'];
+ $data['Password'] = $updata['newPassword'];
+ $data['Password_Date'] = $updata['Password_Date'];
+ $this->db->where('MobileNumber', $updata['emp_Ph']);
+ //$this->db->where('Password',$updata['oldPassword']);
+ $this->db->update(LOGIN, $data);
+
+
+ $result['updateStatus'] = true;
+ $result['message'] = "Updated Successfully.";
+
+ }
+ else
+ {
+
+
+ $result['updateStatus'] = false;
+ $result['message'] = "Please Enter Correct Correct Details.";
+ }
+
+ return $result;
+
+ }
+
+
+
diff --git a/Apollo/assets/i18n/en.json b/Apollo/assets/i18n/en.json
index bdcdb4c3..6ce98ed9 100755
--- a/Apollo/assets/i18n/en.json
+++ b/Apollo/assets/i18n/en.json
@@ -139,7 +139,8 @@
"LOGIN": "Login",
"REGISTRATION": "Registration",
"FORGOT": "Forgot Password",
- "LOCKSCREEN": "Lock Screen"
+ "LOCKSCREEN": "Lock Screen",
+ "Login_pwdchange":"Login_pwdchange"
},
"tracking": {
"MAIN": "CALL TRACKING",
diff --git a/Apollo/assets/js/config.constant.js b/Apollo/assets/js/config.constant.js
index b73dbea9..b0db5cf9 100755
--- a/Apollo/assets/js/config.constant.js
+++ b/Apollo/assets/js/config.constant.js
@@ -69,6 +69,8 @@ app.constant('JS_REQUIRES', {
'changePasswordCtrl': 'assets/js/controllers/changePasswordCtrl.js',
+ 'change_loginpwdCtrl': 'assets/js/controllers/change_loginpwdCtrl.js',
+
/***
* Session
*/
diff --git a/Apollo/assets/js/config.router.js b/Apollo/assets/js/config.router.js
index 8040b6c5..2e8a03c3 100755
--- a/Apollo/assets/js/config.router.js
+++ b/Apollo/assets/js/config.router.js
@@ -44,6 +44,10 @@ app.config(['$stateProvider', '$urlRouterProvider', '$controllerProvider', '$com
url: '/signin',
templateUrl: "assets/views/login_login.html",
resolve: loadSequence('loginCtrl')
+ }).state('login.Login_pwdchange', {
+ url: '/Login_pwdchange',
+ templateUrl: "assets/views/changelogin_password.html",
+ resolve: loadSequence('change_loginpwdCtrl')
}).state('login.forgot', {
url: '/forgot',
templateUrl: "assets/views/login_forgot.html",
diff --git a/Apollo/assets/js/controllers/change_loginpwdCtrl.js b/Apollo/assets/js/controllers/change_loginpwdCtrl.js
new file mode 100644
index 00000000..ed6f03e6
--- /dev/null
+++ b/Apollo/assets/js/controllers/change_loginpwdCtrl.js
@@ -0,0 +1,6 @@
+'use strict';
+/*** controller for Wizard Form example***/
+app.controller('change_loginpwdCtrl', ["$scope", "$filter", "ngTableParams", "API_POINTS", "$http", "SweetAlert", "$state", 'md5', 'ipCookie', function ($scope, $filter, ngTableParams, apiPoint, $http, SweetAlert, $state, md5, ipCookie) {
+
+
+}]);
diff --git a/Apollo/assets/js/controllers/loginCtrl.js b/Apollo/assets/js/controllers/loginCtrl.js
index 4b4fa081..6c578ce8 100755
--- a/Apollo/assets/js/controllers/loginCtrl.js
+++ b/Apollo/assets/js/controllers/loginCtrl.js
@@ -71,6 +71,8 @@ app.controller('loginCtrl', ["$scope", "$http", "API_POINTS", "$state", '$rootSc
}
};
$http(req).then(function (response) {
+ // console.log(response.data);return false;
+
if (response.data.loginStatus == true) {
@@ -118,12 +120,24 @@ app.controller('loginCtrl', ["$scope", "$http", "API_POINTS", "$state", '$rootSc
else{
// $window.location.reload();
$state.go('app.dashboard');
+
+ //$state.go('login.Login_pwdchange');
// $window.location.reload();
}
}
- } else {
+ }
+ else if((response.data.loginStatus == false) &&(response.data.passwordStatus==false))
+ {
+ console.log('else if')
+
+ $state.go('login.Login_pwdchange');
+ }
+
+
+
+ else {
// alert(response.data.message);
if($scope.Empcheck == false)
{
@@ -320,4 +334,81 @@ $scope.EmpLogin=function(myModel)
});
}
}
-}]);
\ No newline at end of file
+
+
+ $scope.myPwdModel = {
+ curr: "",
+ newpassword: "",
+ empid:""
+ };
+
+
+ $scope.ChangePassword = function (Form,myPwdModel)
+ {
+ var userId = myPwdModel.empid;
+ var oldPassword = myPwdModel.curr;
+ var newPassword = myPwdModel.newpassword
+ //var passwordLength = newPassword.length;
+
+ //console.log(passwordLength)
+ if((userId == undefined)||(oldPassword =="")||(oldPassword == undefined)||(newPassword == undefined))
+ {
+
+ swal("Please Enter all the Fields, New Password Should Consist 8 letters!", "", "warning");
+ }
+
+ else
+ {
+ var req = {
+ method: 'POST',
+ url: apiPoint.url + 'changePasswordLogin/',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ data: {
+ oldPassword: md5.createHash(oldPassword || ''),
+ newPassword: md5.createHash(newPassword || '') ,
+ UserId: userId,
+ }
+ };
+
+ $http(req).then(function (response) {
+
+ console.log(response.data)
+ if (response.data.changePassStatus == true)
+ {
+ swal(" Success", message, "success");
+ form.$setPristine(true);
+ $scope.myModel = {
+ curr: "",
+ password1: "",
+ password2: ""
+ };
+ }
+
+ else
+ {
+ swal("Error",response.data.message, "error");
+ }
+
+
+ },
+ function (error) {
+ //error function
+ });
+
+
+
+ }
+
+ }
+
+
+
+
+
+
+}]);
+
+
+
diff --git a/Apollo/assets/js/controllers/sessionCtrl.js b/Apollo/assets/js/controllers/sessionCtrl.js
index 82602a85..9da4b86d 100755
--- a/Apollo/assets/js/controllers/sessionCtrl.js
+++ b/Apollo/assets/js/controllers/sessionCtrl.js
@@ -81,7 +81,7 @@ app.controller('sessionCtrl', ["$scope", "$localStorage", "$state", 'ipCookie',
let remTime = Math.floor((dateNowTime-lastActiveTime)/ 1000);
idletime = remTime;
// converting from milliseconds to seconds
- // console.log("Idle since "+remTime+" Seconds Last active at "+this.lastActiveTime);
+ console.log("Idle since "+remTime+" Seconds Last active at "+this.lastActiveTime);
if(remTime>'10800')
{
console.log('inremtime')
diff --git a/Apollo/assets/views/changelogin_password.html b/Apollo/assets/views/changelogin_password.html
new file mode 100644
index 00000000..219baa84
--- /dev/null
+++ b/Apollo/assets/views/changelogin_password.html
@@ -0,0 +1,72 @@
+Your Password Expired!! Please Change Password
+