Skip to content

Commit d449b02

Browse files
committed
fixed rfc7515
1 parent b1a118b commit d449b02

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Frontend/src/app/id-generator/id-generator.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ <h2>ID Generator</h2>
5656
(change)="generate()" />
5757
<label class="form-check-label" for="base64">Base64</label>
5858
</div>
59-
<!-- <div class="form-check">
59+
<div class="form-check">
6060
<input class="form-check-input" type="checkbox" id="rfc7515" [disabled]="!base64" [(ngModel)]="rfc7515" (change)="generate()" />
6161
<label class="form-check-label" for="rfc7515">RFC7515</label>
62-
</div> -->
62+
</div>
6363
<div class="form-check">
6464
<input class="form-check-input" type="checkbox" id="urlEncode" [disabled]="!base64"
6565
[(ngModel)]="urlEncode" (change)="generate()" />

Frontend/src/app/id-generator/id-generator.component.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { valueChangeAnim } from '../../animations/common-animations';
44
import { Meta } from '@angular/platform-browser';
55
import { FormsModule } from '@angular/forms';
66
import { v4 as uuidv4 } from 'uuid';
7-
import {nanoid} from 'nanoid';
7+
import { nanoid } from 'nanoid';
88

99
@Component({
1010
selector: 'app-id-generator',
@@ -13,14 +13,14 @@ import {nanoid} from 'nanoid';
1313
templateUrl: './id-generator.component.html',
1414
animations: [valueChangeAnim]
1515
})
16-
export class IdGeneratorComponent {
16+
export class IdGeneratorComponent {
1717
protected status: boolean = false;
1818
protected idsCode: string = "";
1919
protected isGuid: boolean = true;
2020
protected uppercase: boolean = false;
2121
protected hyphen: boolean = true;
2222
protected base64: boolean = false;
23-
// protected rfc7515: boolean = false;
23+
protected rfc7515: boolean = false;
2424
protected urlEncode: boolean = false;
2525
protected count: number = 7;
2626
protected prepend: string = "{\"";
@@ -38,11 +38,11 @@ export class IdGeneratorComponent {
3838
protected generate() {
3939
this.idsCode = "";
4040
for (let i = 0; i < this.count; i++) {
41-
let id = this.isGuid? uuidv4().toString() : nanoid().toString();
41+
let id = this.isGuid ? uuidv4().toString() : nanoid().toString();
4242
if (this.uppercase) id = id.toUpperCase();
4343
if (this.isGuid) if (!this.hyphen) id = id.replaceAll("-", "");
4444
if (this.base64) id = btoa(id);
45-
// if (this.rfc7515) id = id.replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
45+
if (this.base64) if (this.rfc7515) id = id.replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
4646
if (this.base64) if (this.urlEncode) id = encodeURIComponent(id);
4747
this.idsCode += this.prepend + id + this.append + "\n";
4848
}

0 commit comments

Comments
 (0)