mirror of
https://github.com/arnaucube/blockchainIDsystem.git
synced 2026-02-07 02:56:43 +01:00
started to implement clientApp (Go + Electron(with Angularjs))
This commit is contained in:
27
clientApp/GUI/views/login/login.html
Executable file
27
clientApp/GUI/views/login/login.html
Executable file
@@ -0,0 +1,27 @@
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="card-title">
|
||||
blockchainIDsystem
|
||||
</h4>
|
||||
|
||||
<input ng-model="user.email" class="form-control" placeholder="Email" type="text">
|
||||
<input ng-model="user.password" class="form-control" placeholder="Password" type="password">
|
||||
|
||||
|
||||
<div ng-click="login()" class="btn btn-raised c_indigo300 pull-right">Login</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-sm-4">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
44
clientApp/GUI/views/login/login.js
Executable file
44
clientApp/GUI/views/login/login.js
Executable file
@@ -0,0 +1,44 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('app.login', ['ngRoute'])
|
||||
|
||||
.config(['$routeProvider', function($routeProvider) {
|
||||
$routeProvider.when('/login', {
|
||||
templateUrl: 'views/login/login.html',
|
||||
controller: 'LoginCtrl'
|
||||
});
|
||||
}])
|
||||
|
||||
.controller('LoginCtrl', function($scope, $http, $routeParams, toastr) {
|
||||
$scope.user = {};
|
||||
$scope.login = function() {
|
||||
console.log('Doing login', $scope.user);
|
||||
console.log(urlapi + "login");
|
||||
$http({
|
||||
url: urlapi + 'login',
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": undefined
|
||||
},
|
||||
data: $scope.user
|
||||
})
|
||||
.then(function(data) {
|
||||
console.log("data: ");
|
||||
console.log(data.data);
|
||||
if (data.data.token) {
|
||||
localStorage.setItem("blid_token", data.data.token);
|
||||
localStorage.setItem("blid_user", JSON.stringify(data.data));
|
||||
window.location.reload();
|
||||
} else {
|
||||
console.log("login failed");
|
||||
toastr.error('Login failed');
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
function(data) {
|
||||
console.log(data);
|
||||
});
|
||||
|
||||
};
|
||||
});
|
||||
31
clientApp/GUI/views/main/main.html
Executable file
31
clientApp/GUI/views/main/main.html
Executable file
@@ -0,0 +1,31 @@
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="card-title">
|
||||
blockchainIDsystem
|
||||
</h4>
|
||||
|
||||
<div ng-click="newID()" class="btn btn-raised c_o_cyan300">Create new ID</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="card-body">
|
||||
<h4 class="card-title">
|
||||
Current IDs
|
||||
</h4>
|
||||
<p ng-repeat="id in ids">
|
||||
{{id}} <div ng-click="" class="btn btn-raised c_o_indigo300">Verify</div>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
35
clientApp/GUI/views/main/main.js
Executable file
35
clientApp/GUI/views/main/main.js
Executable file
@@ -0,0 +1,35 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('app.main', ['ngRoute'])
|
||||
|
||||
.config(['$routeProvider', function($routeProvider) {
|
||||
$routeProvider.when('/main', {
|
||||
templateUrl: 'views/main/main.html',
|
||||
controller: 'MainCtrl'
|
||||
});
|
||||
}])
|
||||
|
||||
.controller('MainCtrl', function($scope, $http) {
|
||||
$scope.ids = [];
|
||||
$http.get(clientapi + 'ids')
|
||||
.then(function(data) {
|
||||
console.log('data success');
|
||||
console.log(data);
|
||||
$scope.ids = data.data;
|
||||
|
||||
}, function(data) {
|
||||
console.log('data error');
|
||||
});
|
||||
|
||||
$scope.newID = function() {
|
||||
$http.get(clientapi + 'newid')
|
||||
.then(function(data) {
|
||||
console.log('data success');
|
||||
console.log(data);
|
||||
$scope.ids = data.data;
|
||||
|
||||
}, function(data) {
|
||||
console.log('data error');
|
||||
});
|
||||
};
|
||||
});
|
||||
30
clientApp/GUI/views/navbar.html
Executable file
30
clientApp/GUI/views/navbar.html
Executable file
@@ -0,0 +1,30 @@
|
||||
<div ng-controller="NavbarCtrl" ng-show="user">
|
||||
<nav class="navbar navbar-fixed-top c_cyanG500to300">
|
||||
<div class="container-fluid">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="/" title="blockchainIDsystem">
|
||||
<img src="img/blockchainIDsystem-logo-white.png" style="width:30px;height:30px;display:inline;" alt=""> <b>blockchainIDsystem</b>
|
||||
</a>
|
||||
</div>
|
||||
<div class="navbar-collapse collapse navbar-responsive-collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li>
|
||||
<a href="">
|
||||
<i title="User" class="fa fa-user fa-1x"></i> {{user.email}}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="" ng-click="logout()">
|
||||
<i title="Exit" class="fa fa-power-off fa-1x"></i>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
22
clientApp/GUI/views/navbar.js
Executable file
22
clientApp/GUI/views/navbar.js
Executable file
@@ -0,0 +1,22 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('app.navbar', ['ngRoute'])
|
||||
|
||||
.config(['$routeProvider', function($routeProvider) {
|
||||
$routeProvider.when('/navbar', {
|
||||
templateUrl: 'views/navbar.html',
|
||||
controller: 'NavbarCtrl'
|
||||
});
|
||||
}])
|
||||
|
||||
.controller('NavbarCtrl', function($scope, $http, $routeParams, $location) {
|
||||
|
||||
$scope.user = JSON.parse(localStorage.getItem("blid_user"));
|
||||
|
||||
$scope.logout = function() {
|
||||
localStorage.removeItem("blid_token");
|
||||
localStorage.removeItem("blid_user");
|
||||
window.location.reload();
|
||||
};
|
||||
|
||||
});
|
||||
41
clientApp/GUI/views/signup/signup.html
Executable file
41
clientApp/GUI/views/signup/signup.html
Executable file
@@ -0,0 +1,41 @@
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<div class="panel">
|
||||
<div class="panel-heading c_deepPurpleG500to300">
|
||||
<h3 class="panel-title">Signup</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="form-group label-floating">
|
||||
<input ng-model="user.username" abmFormControl class="form-control" id="inputUsername" placeholder="Username" type="text">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input ng-model="user.password" abmFormControl class="form-control" id="inputPassword" placeholder="Password" type="password">
|
||||
</div>
|
||||
<div class="form-group label-floating">
|
||||
<input ng-model="user.email" abmFormControl class="form-control" id="inputEmail" placeholder="Email" type="text">
|
||||
</div>
|
||||
<div class="form-group label-floating">
|
||||
<input ng-model="user.phone" abmFormControl class="form-control" id="inputPhone" placeholder="Phone" type="text">
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="staticEmail" class="col-sm-1 col-form-label">@</label>
|
||||
<div class="col-sm-10">
|
||||
<input ng-model="user.telegram" abmFormControl class="form-control" id="inputTelegram" placeholder="Telegram" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<a ng-href="#!/login" class="btn btn-raised c_grey500">Back</a>
|
||||
<div ng-click="doSignup()" class="btn btn-raised c_deepPurple300 pull-right">Signup</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-sm-4">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
43
clientApp/GUI/views/signup/signup.js
Executable file
43
clientApp/GUI/views/signup/signup.js
Executable file
@@ -0,0 +1,43 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('app.signup', ['ngRoute'])
|
||||
|
||||
.config(['$routeProvider', function($routeProvider) {
|
||||
$routeProvider.when('/signup', {
|
||||
templateUrl: 'views/signup/signup.html',
|
||||
controller: 'SignupCtrl'
|
||||
});
|
||||
}])
|
||||
|
||||
.controller('SignupCtrl', function($scope, $http, $routeParams) {
|
||||
$scope.user = {};
|
||||
$scope.doSignup = function() {
|
||||
console.log('Doing login', $scope.user);
|
||||
|
||||
$http({
|
||||
url: urlapi + 'signup',
|
||||
method: "POST",
|
||||
data: $scope.user
|
||||
})
|
||||
.then(function(response) {
|
||||
console.log("response: ");
|
||||
console.log(response.data);
|
||||
if (response.data.success == true)
|
||||
{
|
||||
localStorage.setItem("cr_webapp_token", response.data.token);
|
||||
localStorage.setItem("cr_webapp_userdata", JSON.stringify(response.data.user));
|
||||
window.location.reload();
|
||||
}else{
|
||||
console.log("signup failed");
|
||||
toastr.error('Signup failed');
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
function(response) { // optional
|
||||
// failed
|
||||
console.log(response);
|
||||
});
|
||||
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user