mirror of
https://github.com/arnaucube/darkID-prototype.git
synced 2026-02-07 19:36:41 +01:00
readme and some clean
This commit is contained in:
43
darkID-login-example/web/views/login/login.html
Executable file
43
darkID-login-example/web/views/login/login.html
Executable file
@@ -0,0 +1,43 @@
|
||||
<div class="container" style="margin-top: -60px;">
|
||||
<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">
|
||||
Some platform login example
|
||||
</h4>
|
||||
<div class="row">
|
||||
<textarea style="color:#000000;width:100%;" rows="4"
|
||||
ng-model="proof.PublicKey"
|
||||
placeholder="Enter here the publicKey of darkID"
|
||||
></textarea>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div ng-click="getproof()" class="btn btn-block btn-raised btn-block c_indigo300 pull-right">Proof of darkID</div>
|
||||
</div>
|
||||
<div ng-show="proof.question">
|
||||
Proof question:
|
||||
<br>
|
||||
<div class="row">
|
||||
<textarea disabled style="color:#81C784;width:100%;" rows="4"
|
||||
ng-model="proof.question"
|
||||
></textarea>
|
||||
</div>
|
||||
<input ng-model="proof.answer" class="form-control" placeholder="Proof answer" type="text">
|
||||
<div class="row">
|
||||
<div ng-click="sendanswer()" class="btn btn-block btn-raised btn-block c_green300 pull-right">Send answer</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-sm-4">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
64
darkID-login-example/web/views/login/login.js
Executable file
64
darkID-login-example/web/views/login/login.js
Executable file
@@ -0,0 +1,64 @@
|
||||
'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, $rootScope, $http, $routeParams, toastr) {
|
||||
$rootScope.server = ""
|
||||
$scope.proof = {
|
||||
publicKey: "",
|
||||
clear: "",
|
||||
question: "",
|
||||
answer: ""
|
||||
};
|
||||
$scope.getproof = function() {
|
||||
$http({
|
||||
url: urlapi + 'getproof',
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": undefined
|
||||
},
|
||||
data: $scope.proof
|
||||
})
|
||||
.then(function(data) {
|
||||
console.log("data: ");
|
||||
console.log(data.data);
|
||||
$scope.proof = data.data;
|
||||
},
|
||||
function(data) {
|
||||
console.log(data);
|
||||
toastr.error("error: bad darkID PublicKey")
|
||||
});
|
||||
|
||||
};
|
||||
$scope.sendanswer = function() {
|
||||
$http({
|
||||
url: urlapi + 'answerproof',
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": undefined
|
||||
},
|
||||
data: $scope.proof
|
||||
})
|
||||
.then(function(data) {
|
||||
console.log("data: ");
|
||||
console.log(data.data);
|
||||
if(data.data=="fail\n") {
|
||||
toastr.error("Proof of darkID failed");
|
||||
}else{
|
||||
toastr.success("You are logged with darkID!");
|
||||
window.location="#!/main";
|
||||
}
|
||||
},
|
||||
function(data) {
|
||||
console.log(data);
|
||||
});
|
||||
|
||||
};
|
||||
});
|
||||
19
darkID-login-example/web/views/main/main.html
Executable file
19
darkID-login-example/web/views/main/main.html
Executable file
@@ -0,0 +1,19 @@
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-sm-2">
|
||||
|
||||
</div>
|
||||
<div class="col-sm-8">
|
||||
<h4 class="card-title">
|
||||
You are logged!
|
||||
</h4>
|
||||
<div class="card">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
15
darkID-login-example/web/views/main/main.js
Executable file
15
darkID-login-example/web/views/main/main.js
Executable file
@@ -0,0 +1,15 @@
|
||||
'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, $rootScope, $http) {
|
||||
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user