change password
This commit is contained in:
@@ -82,6 +82,17 @@ class usersController extends MY_Controller {
|
|||||||
$this->json( ['success' => TRUE, 'userID' => $userID] );
|
$this->json( ['success' => TRUE, 'userID' => $userID] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function savePassword()
|
||||||
|
{
|
||||||
|
$password = $this->clean_input( 'password' );
|
||||||
|
|
||||||
|
$user = User::find( USERID );
|
||||||
|
|
||||||
|
$saltedPassword = User::getSaltedPassword( $password, $user->salt );
|
||||||
|
|
||||||
|
User::whereId( USERID )->update( ['password' => $saltedPassword] );
|
||||||
|
}
|
||||||
|
|
||||||
public function archiveUser( $userID, $status )
|
public function archiveUser( $userID, $status )
|
||||||
{
|
{
|
||||||
User::whereId( $userID )->update( ['archive' => $status] );
|
User::whereId( $userID )->update( ['archive' => $status] );
|
||||||
|
|||||||
@@ -30,9 +30,31 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<a href="#" class="dbois-exit"
|
<div class="col-xs-9 col-xs-offset-3">
|
||||||
data-bind="click:logOut">uitloggen</a>
|
<a href="#" class="dbois-exit"
|
||||||
<div class="clock"></div>
|
data-bind="click:logOut">uitloggen</a>
|
||||||
|
<div class="clock"></div>
|
||||||
|
<!-- ko if: hidePasswordinput() -->
|
||||||
|
<label class="change-password"
|
||||||
|
data-bind="click:togglePasswordinput">
|
||||||
|
wachtwoord wijzigen
|
||||||
|
</label>
|
||||||
|
<!-- /ko -->
|
||||||
|
<!-- ko if: ! hidePasswordinput() -->
|
||||||
|
<div class="change-password">
|
||||||
|
<div class="col-xs-5">
|
||||||
|
<input type="password"
|
||||||
|
data-bind="textinput:newPassword, event:{'keyup':checkPassword}"
|
||||||
|
class="form-control" placeholder="type hier uw wachtwoord" />
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-2">
|
||||||
|
<button class="btn btn-success"
|
||||||
|
data-bind="disable:!validPassword(),click:savePassword">wachtwoord aanvragen</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- /ko -->
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<?php $this->load->view( 'partials/_navbar-left' ); ?>
|
<?php $this->load->view( 'partials/_navbar-left' ); ?>
|
||||||
|
|||||||
@@ -269,4 +269,17 @@ top: -2px;
|
|||||||
margin-right:10px
|
margin-right:10px
|
||||||
}
|
}
|
||||||
|
|
||||||
|
label.change-password {
|
||||||
|
float: right;
|
||||||
|
margin-top: 8px;;
|
||||||
|
}
|
||||||
|
label.change-password:hover {
|
||||||
|
color: #fff;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
div.change-password {
|
||||||
|
margin-right: 140px;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -58,6 +58,13 @@ dbo.userDataService = {
|
|||||||
} );
|
} );
|
||||||
},
|
},
|
||||||
|
|
||||||
|
savePassword: function ( password, callback ) {
|
||||||
|
$.post( '/index.php/beheer/usersController/savePassword', {password: password} )
|
||||||
|
.done( function () {
|
||||||
|
callback();
|
||||||
|
} );
|
||||||
|
},
|
||||||
|
|
||||||
archiveUser: function ( userID, status, callback ) {
|
archiveUser: function ( userID, status, callback ) {
|
||||||
$.get( 'index.php/beheer/usersController/archiveUser/' + userID + '/' + status )
|
$.get( 'index.php/beheer/usersController/archiveUser/' + userID + '/' + status )
|
||||||
.done( function () {
|
.done( function () {
|
||||||
|
|||||||
@@ -10,8 +10,11 @@ $( function () {
|
|||||||
|
|
||||||
dbo.menuModel = {
|
dbo.menuModel = {
|
||||||
|
|
||||||
pages : ko.observable(),
|
pages : ko.observable(),
|
||||||
initialized: ko.observable( false ),
|
initialized : ko.observable( false ),
|
||||||
|
hidePasswordinput: ko.observable(true),
|
||||||
|
newPassword : ko.observable(),
|
||||||
|
validPassword : ko.observable(),
|
||||||
|
|
||||||
|
|
||||||
init: function () {
|
init: function () {
|
||||||
@@ -32,11 +35,48 @@ $( function () {
|
|||||||
} );
|
} );
|
||||||
},
|
},
|
||||||
|
|
||||||
logOut : function(){
|
checkPassword: function () {
|
||||||
dbo.userDataService.logOut(function(){
|
var vm = dbo.menuModel;
|
||||||
location.reload();
|
|
||||||
});
|
|
||||||
|
|
||||||
|
if ( vm.newPassword().length >= 8 ) {
|
||||||
|
vm.validPassword( true );
|
||||||
|
} else {
|
||||||
|
vm.validPassword( false );
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
logOut: function () {
|
||||||
|
dbo.userDataService.logOut( function () {
|
||||||
|
location.reload();
|
||||||
|
} );
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
togglePasswordinput: function () {
|
||||||
|
if ( dbo.menuModel.hidePasswordinput() == true ) {
|
||||||
|
var tellMeOptions = {
|
||||||
|
title : 'Wijzig wachtwoord',
|
||||||
|
message : 'Uw gewijzigde wachtwoord dient uit tenminste 8 tekens te bestaan',
|
||||||
|
modalClass: 'modal-warning'
|
||||||
|
}
|
||||||
|
tellMe( tellMeOptions )
|
||||||
|
}
|
||||||
|
dbo.menuModel.hidePasswordinput( !dbo.menuModel.hidePasswordinput() );
|
||||||
|
},
|
||||||
|
|
||||||
|
savePassword: function () {
|
||||||
|
var vm = dbo.menuModel;
|
||||||
|
|
||||||
|
dbo.userDataService.savePassword( vm.newPassword, function () {
|
||||||
|
var tellMeOptions = {
|
||||||
|
title : 'Uw wachtwoord is gewijzigd',
|
||||||
|
message : 'U kunt nu met uw gewijzigde wachtwoord inloggen',
|
||||||
|
modalClass: 'modal-warning'
|
||||||
|
}
|
||||||
|
tellMe( tellMeOptions );
|
||||||
|
|
||||||
|
dbo.menuModel.hidePasswordinput( !dbo.menuModel.hidePasswordinput() );
|
||||||
|
} )
|
||||||
},
|
},
|
||||||
|
|
||||||
setPage: function ( page ) {
|
setPage: function ( page ) {
|
||||||
@@ -59,9 +99,9 @@ $( function () {
|
|||||||
|
|
||||||
dbo.menuModel.init();
|
dbo.menuModel.init();
|
||||||
|
|
||||||
$(".open-submenu").click(function(){
|
$( ".open-submenu" ).click( function () {
|
||||||
$("#sub-" + $(this).attr('id')).slideToggle('slow');
|
$( "#sub-" + $( this ).attr( 'id' ) ).slideToggle( 'slow' );
|
||||||
});
|
} );
|
||||||
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user