8000 Finished projects JWT part 2 · CodeMazeBlog/aspnetcore-jwt-auth@b5460d6 · GitHub
[go: up one dir, main page]

Skip to content

Commit b5460d6

Browse files
Finished projects JWT part 2
1 parent a38c71a commit b5460d6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+10191
-1
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/webapplication-finish/.vs
2+
/webapplication-finish/.vscode
3+
/webapplication-finish/bin
4+
/webapplication-finish/obj

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# aspnetcore-jwt-auth
1+
# aspnetcore-jwt-auth part 2 - end

ng-auth-finished/.angular-cli.json

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"project": {
4+
"name": "hello-world"
5+
},
6+
"apps": [
7+
{
8+
"root": "src",
9+
"out F438 Dir": "dist",
10+
"assets": [
11+
"assets",
12+
"favicon.ico"
13+
],
14+
"index": "index.html",
15+
"main": "main.ts",
16+
"polyfills": "polyfills.ts",
17+
"test": "test.ts",
18+
"tsconfig": "tsconfig.app.json",
19+
"testTsconfig": "tsconfig.spec.json",
20+
"prefix": "app",
21+
"styles": [
22+
"styles.css"
23+
],
24+
"scripts": [],
25+
"environmentSource": "environments/environment.ts",
26+
"environments": {
27+
"dev": "environments/environment.ts",
28+
"prod": "environments/environment.prod.ts"
29+
}
30+
}
31+
],
32+
"e2e": {
33+
"protractor": {
34+
"config": "./protractor.conf.js"
35+
}
36+
},
37+
"lint": [
38+
{
39+
"project": "src/tsconfig.app.json"
40+
},
41+
{
42+
"project": "src/tsconfig.spec.json"
43+
},
44+
{
45+
"project": "e2e/tsconfig.e2e.json"
46+
}
47+
],
48+
"test": {
49+
"karma": {
50+
"config": "./karma.conf.js"
51+
}
52+
},
53+
"defaults": {
54+
"styleExt": "css",
55+
"component": {}
56+
}
57+
}

ng-auth-finished/.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Editor configuration, see http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
indent_style = space
7+
indent_size = 2
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
max_line_length = off
13+
trim_trailing_whitespace = false

ng-auth-finished/.gitignore

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# See http://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# compiled output
4+
/dist
5+
/tmp
6+
/out-tsc
7+
8+
# dependencies
9+
/node_modules
10+
11+
# IDEs and editors
12+
/.idea
13+
.project
14+
.classpath
15+
.c9/
16+
*.launch
17+
.settings/
18+
*.sublime-workspace
19+
20+
# IDE - VSCode
21+
.vscode/*
22+
!.vscode/settings.json
23+
!.vscode/tasks.json
24+
!.vscode/launch.json
25+
!.vscode/extensions.json
26+
27+
# misc
28+
/.sass-cache
29+
/connect.lock
30+
/coverage
31+
/libpeerconnection.log
32+
npm-debug.log
33+
testem.log
34+
/typings
35+
36+
# e2e
37+
/e2e/*.js
38+
/e2e/*.map
39+
40+
# System Files
41+
.DS_Store
42+
Thumbs.db

ng-auth-finished/.vscode/launch.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "node",
9+
"request": "launch",
10+
"name": "Launch Program",
11+
"program": "${workspaceFolder}\\serve",
12+
"preLaunchTask": "tsc: build - tsconfig.json",
13+
"outFiles": [
14+
"${workspaceFolder}/dist/out-tsc/**/*.js"
15+
]
16+
}
17+
]
18+
}

ng-auth-finished/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# HelloWorld
2+
3+
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.1.1.
4+
5+
## Development server
6+
7+
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
8+
9+
## Code scaffolding
10+
11+
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|module`.
12+
13+
## Build
14+
15+
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build.
16+
17+
## Running unit tests
18+
19+
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
20+
21+
## Running end-to-end tests
22+
23+
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
24+
Before running the tests make sure you are serving the app via `ng serve`.
25+
26+
## Further help
27+
28+
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).

ng-auth-finished/e2e/app.e2e-spec.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { HelloWorldPage } from './app.po';
2+
3+
describe('hello-world App', () => {
4+
let page: HelloWorldPage;
5+
6+
beforeEach(() => {
7+
page = new HelloWorldPage();
8+
});
9+
10+
it('should display welcome message', () => {
11+
page.navigateTo();
12+
expect(page.getParagraphText()).toEqual('Welcome to app!!');
13+
});
14+
});

ng-auth-finished/e2e/app.po.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { browser, by, element } from 'protractor';
2+
3+
export class HelloWorldPage {
4+
navigateTo() {
5+
return browser.get('/');
6+
}
7+
8+
getParagraphText() {
9+
return element(by.css('app-root h1')).getText();
10+
}
11+
}
Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
function roundTo(n, digits) {
2+
var negative = false;
3+
if (digits === undefined) {
4+
digits = 0;
5+
}
6+
if (n < 0) {
7+
negative = true;
8+
n = n * -1;
9+
}
10+
var multiplicator = Math.pow(10, digits);
11+
n = parseFloat((n * multiplicator).toFixed(11));
12+
n = (Math.round(n) / multiplicator).toFixed(2);
13+
if (negative) {
14+
n = (n * -1).toFixed(2);
15+
}
16+
return n;
17+
}
18+
19+
// Basic Odds Functions
20+
function calcDecimal2odds(decimal) {
21+
var num = decimal;
22+
if (decimal <= 2) //negative odds
23+
{
24+
num = Math.round((-100) / (decimal - 1));
25+
}
26+
else //positive odds
27+
{
28+
num = Math.round((decimal - 1) * 100);
29+
}
30+
return num;
31+
}
32+
function calcOdds2decimal(odds) {
33+
var num = odds;
34+
if (odds <= 100) //negative odds
35+
{
36+
num = (100 / -odds) + 1;
37+
num = roundTo(num, 2)
38+
}
39+
else //positive odds
40+
{
41+
num = (odds / 100) + 1;
42+
num = roundTo(num, 2)
43+
}
44+
return num;
45+
}
46+
47+
function calcDecimal2IP(decimal) {
48+
var num = decimal;
49+
num = Math.round(100 * (1 / decimal)) + "%";
50+
return num;
51+
}
52+
function calcOdds2IP(odds) {
53+
var num = odds;
54+
if (odds <= 100) //negative odds
55+
{
56+
//num=Math.round(100*(1/odds))+"%";
57+
num = -100 * (odds / (-odds + 100));
58+
num = roundTo(num, 0);
59+
}
60+
else {
61+
//num=Math.round(100*(1/odds))+"%";
62+
num = 100 * (odds / (odds + 100));
63+
num = roundTo(num, 0);
64+
}
65+
return num;
66+
}
67+
68+
// Odds Converter Page
69+
function propsodds(theseodds, theseoddsid) {
70+
var oddstype = theseoddsid.replace('odds', ''); var usodds = document.getElementById('usodds'); var decodds = document.getElementById('decodds'); var fracodds = document.getElementById('fracodds'); var probodds = document.getElementById('probodds'); var hkodds = document.getElementById('hkodds'); var indodds = document.getElementById('indodds'); var malodds = document.getElementById('malodds'); var myDec; if (theseodds.match(/^Ev.*$/i)) { theseodds = 2; oddstype = 'dec'; }
71+
if (oddstype == 'us') { myDec = US2dec(theseodds); }
72+
else if (oddstype == 'dec') {
73+
if (1 * theseodds < 0) { theseodds = Math.abs(1 * theseodds); }
74+
if (1 * theseodds < 1) { theseodds = 1; }
75+
myDec = parseFloat(theseodds).toFixed(4);
76+
} else if (oddstype == 'frac') {
77+
var sThisOdds = "" + theseodds; if (!sThisOdds.match(/\//)) { sThisOdds = sThisOdds + '/1'; }
78+
myDec = frac2dec(sThisOdds);
79+
} else if (oddstype == 'prob') { var sThisOdds = "" + theseodds; theseodds = fmtNumber(sThisOdds); if (theseodds >= 1) theseodds /= 100; myDec = prob2dec(theseodds); } else if (oddstype == 'hk') { myDec = HK2dec(theseodds); } else if (oddstype == 'ind') { myDec = Indo2dec(theseodds); } else if (oddstype == 'mal') { myDec = Malay2dec(theseodds); }
80+
bet.value = bet.value;
81+
usodds.value = dec2US(myDec);
82+
decodds.value = myDec;
83+
fracodds.value = dec2frac(myDec);
84+
probodds.value = dec2prob(myDec);
85+
hkodds.value = dec2HK(myDec);
86+
indodds.value = dec2Indo(myDec);
87+
malodds.value = dec2Malay(myDec);
88+
winnings.value = bet.value * (myDec - 1);
89+
90+
}
91+
function dec2US(myDec) {
92+
var myUS;
93+
myDec = parseFloat(myDec);
94+
if (myDec <= 1 || myDec == NaN) { myUS = NaN; }
95+
else if (myDec < 2) { myUS = -100 / (myDec - 1); }
96+
else { myUS = (myDec - 1) * 100; }
97+
return (myUS > 0 ? "+" : "") + Math.round(myUS * 100) / 100;
98+
}
99+
function US2dec(myUS) {
100+
var myDec;
101+
myUS = parseFloat(myUS);
102+
if (Math.abs(myUS) < 100 || myUS == NaN) { myDec = NaN; }
103+
else if (myUS > 0) { myDec = 1 + myUS / 100; }
104+
else { myDec = 1 - 100 / myUS; }
105+
return myDec.toFixed(4);
106+
}
107+
function dec2frac(dec) {
108+
dec = parseFloat(dec - 1);
109+
var myBestFrac = Math.round(dec) + "/" + 1; var myBestFracVal = Math.round(dec);
110+
var myBestErr = Math.abs(myBestFracVal - dec);
111+
for (i = 2; i <= 200; i++) {
112+
var myFracVal = Math.round(dec * i) / i;
113+
var myErr = Math.abs(myFracVal - dec);
114+
if (myErr < myBestErr) {
115+
myBestFrac = Math.round(dec * i) + "/" + i; myBestFracVal = myFracVal;
116+
if (myErr == 0) break; myBestErr = myErr;
117+
}
118+
}
119+
return (myBestFrac);
120+
}
121+
function frac2dec(frac) {
122+
var myArr = frac.split(/\//);
123+
myArr[1] = myArr[1] == undefined ? 1 : myArr[1];
124+
return ((myArr[0] / myArr[1] + 1).toFixed(4));
125+
}
126+
function prob2dec(prob) { return (1 / fmtNumber(prob)).toFixed(4); }
127+
function dec2prob(dec) { return fmtPercent(1 / dec); }
128+
function HK2dec(myHK) {
129+
var myDec; myHK = parseFloat(myHK);
130+
if (myHK <= 0 || myHK == NaN) { myDec = NaN; }
131+
else { myDec = (myHK + 1); }
132+
return myDec.toFixed(4);
133+
}
134+
function dec2HK(myDec) {
135+
var myHK; myDec = parseFloat(myDec);
136+
if (myDec <= 1 || myDec == NaN) { myHK = NaN; }
137+
else { myHK = (myDec - 1); }
138+
return myHK.toFixed(4);
139+
}
140+
function Indo2dec(myIndo) {
141+
var myDec; myIndo = parseFloat(myIndo);
142+
if (myIndo == NaN || Math.abs(myIndo) < 1) { myDec = NaN; }
143+
else if (myIndo >= 1) { myDec = (myIndo + 1); }
144+
else { myDec = 1 - 1 / myIndo; }
145+
return myDec.toFixed(4);
146+
}
147+
function dec2Indo(myDec) {
148+
var myIndo; myDec = parseFloat(myDec);
149+
if (myDec <= 1 || myDec == NaN) { myIndo = NaN; }
150+
else if (myDec >= 2) { myIndo = (myDec - 1); }
151+
else { myIndo = 1 / (1 - myDec); }
152+
return myIndo.toFixed(4);
153+
}
154+
function Malay2dec(myMalay) {
155+
var myDec; myMalay = parseFloat(myMalay);
156+
if (myMalay == NaN || myMalay > 1 || myMalay == 0) { myDec = NaN; }
157+
else if (myMalay > 0) { myDec = (myMalay + 1); }
158+
else { myDec = 1 - 1 / myMalay; }
159+
return myDec.toFixed(4);
160+
}
161+
function dec2Malay(myDec) {
162+
var myMalay; myDec = parseFloat(myDec);
163+
if (myDec <= 1 || myDec == NaN) { myMalay = NaN; }
164+
else if (myDec <= 2) { myMalay = (myDec - 1); }
165+
else { myMalay = 1 / (1 - myDec); }
166+
return myMalay.toFixed(4);
167+
}
168+
function fmtNumber(myString) {
169+
myString = "" + myString; myString = myString.replace(/\$/g, "");
170+
myNum = myString.replace(/\,/g, "");
171+
if (myString.match(/\%$/g, "")) {
172+
myNum = myString.replace(/\%$/g, "")
173+
mynum = parseFloat(myNum) / 100;
174+
}
175+
return (1 * myNum);
176+
}
177+
function fmtPercent(myNum) {
178+
if (("" + myNum).match(/\%$/g, "")) { myNum = myNum.replace(/\%$/g, ""); myNum /= 100; }
179+
return (((myNum * 100).toFixed(2)) + "%");
180+
}
181+
function addCommas(nStr) {
182+
nStr += ''; var x = nStr.split('.');
183+
var x1 = x[0]; var x2 = x.length > 1 ? '.' + x[1] : '';
184+
var rgx = /(\d+)(\d{3})/;
185+
while (rgx.test(x1)) { x1 = x1.replace(rgx, '$1' + ',' + '$2'); }
186+
return x1 + x2;
187+
}

0 commit comments

Comments
 (0)
0