Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
TimeOutAdmin
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
TimeOut
TimeOutAdmin
Commits
71fd564a
Commit
71fd564a
authored
Mar 19, 2020
by
Tobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
checker password reset
parent
50a24ea2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
5 deletions
+53
-5
Checker.php
application/controllers/Checker.php
+33
-0
Checker_model.php
application/models/Checker_model.php
+17
-5
viewChecker.php
application/views/Checker/viewChecker.php
+3
-0
No files found.
application/controllers/Checker.php
View file @
71fd564a
...
...
@@ -155,5 +155,37 @@ class Checker extends CI_Controller {
$this
->
load
->
view
(
'template'
,
$template
);
}
function
resetPassword
(
$checker_id
=
''
){
$flashMsg
=
array
(
'message'
=>
'Something went wrong, please try again..!'
,
'class'
=>
'error'
);
if
(
empty
(
$checker_id
)
||
!
is_numeric
(
$checker_id
=
decode_param
(
$checker_id
))){
$this
->
session
->
set_flashdata
(
'message'
,
$flashMsg
);
redirect
(
base_url
(
'Checker/viewCheckers'
));
}
$unique_id
=
$this
->
Checker_model
->
resetPassword
(
$checker_id
);
$checkerData
=
$this
->
Checker_model
->
getCheckerData
(
''
,
''
,
$checker_id
);
if
(
empty
(
$unique_id
)
||
empty
(
$checkerData
)){
$this
->
session
->
set_flashdata
(
'message'
,
$flashMsg
);
redirect
(
base_url
(
'Checker/viewCheckers'
));
}
$subject
=
"New Password for Checker Account"
;
$email_id
=
$checkerData
->
username
;
$message
=
"<html>
<body>
New password of your Checker Account for the username
<strong>"
.
$checkerData
->
username
.
"</strong> is <strong>"
.
$unique_id
.
"</strong><br>
</body>
</html>"
;
$this
->
load
->
model
(
'Api_model'
);
$this
->
Api_model
->
send_mail
(
$subject
,
$email_id
,
$message
);
$flashMsg
=
array
(
'message'
=>
'New Password Generated..!'
,
'class'
=>
'success'
);
$this
->
session
->
set_flashdata
(
'message'
,
$flashMsg
);
redirect
(
base_url
(
'Checker/viewCheckers'
));
}
}
?>
\ No newline at end of file
application/models/Checker_model.php
View file @
71fd564a
...
...
@@ -4,15 +4,16 @@ class Checker_model extends CI_Model {
parent
::
_construct
();
}
public
function
getCheckerData
(
$provider_id
=
''
,
$view
=
''
){
public
function
getCheckerData
(
$provider_id
=
''
,
$view
=
''
,
$checker_id
=
''
){
$cond
=
(
!
empty
(
$view
))
?
" CHK.status IN (
$view
) "
:
" CHK.status != '2' "
;
$cond
.=
(
!
empty
(
$checker_id
))
?
" AND CHK.id='
$checker_id
' "
:
""
;
$cond
.=
(
!
empty
(
$provider_id
))
?
" AND PRV.provider_id='
$provider_id
' "
:
""
;
$checkerData
=
$this
->
db
->
query
(
"SELECT CHK.*,PRV.name
FROM checker AS CHK
INNER JOIN provider AS PRV ON (CHK.provider_id=PRV.provider_id)
WHERE
$cond
"
);
return
$checkerData
->
result
();
FROM checker AS CHK
INNER JOIN provider AS PRV ON (CHK.provider_id=PRV.provider_id)
WHERE
$cond
"
);
return
(
!
empty
(
$checker_id
))
?
$checkerData
->
row_array
()
:
$checkerData
->
result
();
}
public
function
createChecker
(
$checkerData
=
array
()){
...
...
@@ -34,5 +35,15 @@ class Checker_model extends CI_Model {
$status
=
$this
->
db
->
update
(
'checker'
,
array
(
'status'
=>
$status
),
array
(
'id'
=>
$id
));
return
$status
;
}
public
function
resetPassword
(
$checker_id
=
''
){
if
(
empty
(
$checker_id
)){
return
0
;
}
$unique_id
=
rand
(
11111111
,
99999999
);
$status
=
$this
->
db
->
update
(
'checker'
,
array
(
'password'
=>
md5
(
$unique_id
),
'status'
=>
1
),
array
(
'id'
=>
$checker_id
));
return
(
$status
)
?
$unique_id
:
0
;
}
}
?>
\ No newline at end of file
application/views/Checker/viewChecker.php
View file @
71fd564a
...
...
@@ -88,6 +88,9 @@
<?=
(
$checker
->
status
==
1
)
?
'Active'
:
'De-activate'
?>
</th>
<td
class=
"center"
>
<a
class=
"btn btn-sm btn-link"
style=
"margin-top:-13px;"
href=
"
<?=
base_url
(
'Checker/resetPassword/'
.
encode_param
(
$checker
->
id
))
?>
"
>
<i
class=
"fa fa-fw fa-key"
></i>
Reset Password
</a><br>
<a
class=
"btn btn-sm btn-danger"
onclick=
"confirmDelete(jQuery(this),'Checker/changeStatus',{'checker_id':'
<?=
encode_param
(
$checker
->
id
)
?>
'})"
status=
"2"
><i
class=
"fa fa-fw fa-trash"
></i>
Delete
</a>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment