Browse Source

added accounts verification system

master
arnaucode 7 years ago
parent
commit
fbfe1ddeed
6 changed files with 48 additions and 6 deletions
  1. +2
    -2
      app.js
  2. +4
    -1
      views/main/main.html
  3. +1
    -0
      views/navbar.html
  4. +7
    -2
      views/navbar.js
  5. +6
    -1
      views/user/user.html
  6. +28
    -0
      views/user/user.js

+ 2
- 2
app.js

@ -1,8 +1,8 @@
'use strict';
var urlapi = "http://localhost:3000/api/";
//var urlapi = "http://localhost:3000/api/";
//var urlapi = "http://192.168.1.36:3000/api/";
//var urlapi = "http://37.59.123.45:3000/api/";
var urlapi = "http://37.59.123.45:3000/api/";
// Declare app level module which depends on views, and components
angular.module('adminApp', [

+ 4
- 1
views/main/main.html

@ -12,7 +12,10 @@
<img class="circle" ng-src="{{user.avatar}}" alt="icon">
</div>
<div class="row-content">
<h4 class="list-group-item-heading">{{user.username}}</h4>
<h4 class="list-group-item-heading">
{{user.username}}
<span ng-show="user.validated" class="badge badge-secondary c_deepPurple300">Validated</span>
</h4>
<p class="list-group-item-text">{{user.description}}</p>
<p class="list-group-item-text">{{user.travels.length}} published travels</p>

+ 1
- 0
views/navbar.html

@ -34,6 +34,7 @@
<li><a href="javascript:void(0)">Separated link</a></li>
</ul>
</li>
<li><a ng-click="logout()">Logout</a></li>
</ul>
</div>
</div>

+ 7
- 2
views/navbar.js

@ -10,7 +10,7 @@ angular.module('app.navbar', ['ngRoute'])
}])
.controller('NavbarCtrl', function($scope, $http, $routeParams, $location) {
$scope.searchString="";
$scope.searchString = "";
$scope.locationHash = $location.path();
console.log($scope.locationHash);
$scope.goBack = function() {
@ -20,6 +20,11 @@ angular.module('app.navbar', ['ngRoute'])
$scope.search = function() {
console.log($scope.searchString);
window.location.href="#!/search/" + $scope.searchString;
window.location.href = "#!/search/" + $scope.searchString;
};
$scope.logout = function() {
localStorage.removeItem("cic_admin_token");
localStorage.removeItem("cic_admin_userdata");
window.location.reload();
};
});

+ 6
- 1
views/user/user.html

@ -12,7 +12,10 @@
<img class="circle" ng-src="{{user.avatar}}" alt="icon">
</div>
<div class="row-content">
<h4 class="list-group-item-heading">{{user.username}}</h4>
<h4 class="list-group-item-heading">
{{user.username}}
<span ng-show="user.validated" class="badge badge-secondary c_deepPurple300">Validated</span>
</h4>
<p class="list-group-item-text">{{user.description}}</p>
</div>
@ -98,6 +101,8 @@
</div>
<div class="panel-body">
<!--<div class="btn btn-block btn-sm c_orange300">Ban user</div>-->
<div ng-show="!user.validated" ng-click="validateUser()" class="btn btn-block btn-sm c_deepPurple300">Validate User</div>
<div ng-show="user.validated" ng-click="unvalidateUser()" class="btn btn-block btn-sm c_red200">Unvalidate User</div>
<div ng-click="deleteUser()" class="btn btn-block btn-sm c_red300">Delete user</div>
</div>
</div>

+ 28
- 0
views/user/user.js

@ -46,4 +46,32 @@ angular.module('app.user', ['ngRoute'])
// failed
});
};
$scope.validateUser = function() {
$http({
url: urlapi + 'admin/users/validate/id/' + $routeParams.userid,
method: "POST",
data: {}
})
.then(function(data) {
/*window.location = "#!/main/";*/
$scope.user = data.data;
},
function(data) { // optional
// failed
});
};
$scope.unvalidateUser = function() {
$http({
url: urlapi + 'admin/users/unvalidate/id/' + $routeParams.userid,
method: "POST",
data: {}
})
.then(function(data) {
/*window.location = "#!/main/";*/
$scope.user = data.data;
},
function(data) { // optional
// failed
});
};
});

Loading…
Cancel
Save