Skip to content

Commit

Permalink
Merge pull request #102 from SeaweedbrainCY/dev
Browse files Browse the repository at this point in the history
Improve homepage privacy and totp edit UX
  • Loading branch information
SeaweedbrainCY authored Jun 11, 2024
2 parents 3def6c6 + 1b84ade commit 4263a73
Show file tree
Hide file tree
Showing 13 changed files with 16 additions and 6 deletions.
10 changes: 5 additions & 5 deletions frontend/src/app/edit-totp/edit-totp.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,15 @@
</div>
<div class="field is-grouped is-flex is-justify-content-center">
<div class="control">
<button class="button is-info is-light block" (click)="cancel()">{{"cancel" | translate }}</button>
<button class="button is-info is-light block" [disabled]="isSaving" (click)="cancel()">{{"cancel" | translate }}</button>
</div>
<div class="control" *ngIf="secret_uuid != '' && secret_uuid != null ">
<button class="button is-danger block" (click)="modal()" data-target="confirmation"
[disabled]="this.userService.getIsVaultLocal()!">{{ 'delete' | translate }}</button>
<button class="button is-danger block" (click)="modal()" data-target="confirmation" [ngClass]="{'is-loading': isDestroying}"
[disabled]="this.userService.getIsVaultLocal()! || isSaving">{{ 'delete' | translate }}</button>
</div>
<div class="control">
<button class="button is-info block" (click)="save()"
[disabled]="this.userService.getIsVaultLocal()! || secretError !='' || nameError != '' || uriError != ''">{{ 'save' | translate }}</button>
<button class="button is-info block" (click)="save()" [ngClass]="{'is-loading': isSaving}"
[disabled]="this.userService.getIsVaultLocal()! || secretError !='' || nameError != '' || uriError != '' || isDestroying">{{ 'save' | translate }}</button>
</div>
</div>
</div>
Expand Down
7 changes: 7 additions & 0 deletions frontend/src/app/edit-totp/edit-totp.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export class EditTOTPComponent implements OnInit{
isTagModalActive = false;
addTagName="";
isEditing = false; // true if editing, false if adding
isSaving = false;
remainingTags:string[] = [];
constructor(
private router: Router,
Expand Down Expand Up @@ -339,6 +340,7 @@ export class EditTOTPComponent implements OnInit{
}

save(){
this.isSaving = true;
if(this.userService.getId() == null){
this.router.navigate(["/login/sessionKilled"], {relativeTo:this.route.root});
}
Expand All @@ -347,10 +349,12 @@ export class EditTOTPComponent implements OnInit{
this.checkSecret();
this.checkURI();
if(this.nameError != "" || this.secretError != "" || this.uriError != ""){
this.isSaving = false;
return;
}
if(this.code == this.translate.instant("totp.error.code")){
this.utils.toastError(this.toastr, this.translate.instant("totp.error.code"),"");
this.isSaving = false;
return;
}

Expand Down Expand Up @@ -378,12 +382,15 @@ export class EditTOTPComponent implements OnInit{
} else {
this.addNewSecret(enc_jsonProperty, property);
}
this.isSaving = false;
});
} catch {
this.translate.get("totp.error.encryption").subscribe((translation: string) => {
this.utils.toastWarning(this.toastr, translation ,"");
this.isSaving = false;
});
}
this.isSaving = false;
}

addNewSecret(enc_property:string, property: Map<string,string>){
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/home/home.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ <h1 class="is-size-1 has-text-centered has-text-weight-bold mt-6 has-text-dark m
<div class="column is-one-third-fullhd is-one-third-widescreen is-one-third-desktop is-two-thirds-tablet is-two-thirds-mobile is-flex is-flex-direction-column is-justify-content-center">
<div class="card has-background-{{example_color}} has-text-white">
<header class="card-header">
<p class="card-header-title has-text-white"><img src="https://icons.duckduckgo.com/ip3/{{example_domain}}.ico" alt="{{example_domain}} logo" width="25px" height="25px" style="margin-right: 6px;">
<p class="card-header-title has-text-white"><img src="assets/example-icons/{{example_ico}}" alt="{{example_domain}} logo" width="25px" height="25px" style="margin-right: 6px;">
{{example_title}}</p>
<button class="card-header-icon" aria-label="edit">
<span class="icon">
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/app/home/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export class HomeComponent implements OnInit {
example_title=""
remainingTime=0;
example_color=""
example_ico=""
last_random_i = 0;
current_color_index = 0;

Expand All @@ -64,6 +65,7 @@ export class HomeComponent implements OnInit {
}

generateExample(){
const icos = ["facebook.ico", "github.ico", "google.ico", "apple.ico", "google.ico", "amazon.ico", "aws.ico", "microsoft.ico", "onedrive.ico", "gitlab.ico"]
const domains = ["facebook.com", "github.com", "google.com", "apple.com", "google.com", "amazon.com", "aws.com", "microsoft.com", "onedrive.com", "gitlab.com"]
const titles = ["Facebook", "Github", "Gmail", "Apple", "Google", "Amazon", "AWS", "Microsoft", "OneDrive", "Gitlab"]
const colors = [ "info", "success", "danger"]
Expand All @@ -75,6 +77,7 @@ export class HomeComponent implements OnInit {
this.example_domain = domains[random_i];
this.example_title = titles[random_i];
this.example_code = (Math.floor(Math.random() * (999999 - 100000 + 1)) + 100000).toString();
this.example_ico = icos[random_i];
this.current_color_index = (this.current_color_index+1)%colors.length;
this.example_color = colors[this.current_color_index];
}
Expand Down
Binary file added frontend/src/assets/example-icons/amazon.ico
Binary file not shown.
Binary file added frontend/src/assets/example-icons/apple.ico
Binary file not shown.
Binary file added frontend/src/assets/example-icons/aws.ico
Binary file not shown.
Binary file added frontend/src/assets/example-icons/facebook.ico
Binary file not shown.
Binary file added frontend/src/assets/example-icons/github.ico
Binary file not shown.
Binary file added frontend/src/assets/example-icons/gitlab.ico
Binary file not shown.
Binary file added frontend/src/assets/example-icons/google.ico
Binary file not shown.
Binary file added frontend/src/assets/example-icons/microsoft.ico
Binary file not shown.
Binary file added frontend/src/assets/example-icons/onedrive.ico
Binary file not shown.

0 comments on commit 4263a73

Please sign in to comment.