Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear login data #51

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 20 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 27 additions & 12 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import {EmbedComponent} from './embed/embed.component';
import {HomeComponent} from './home/home.component';
import {LogoutComponent} from './logout/logout.component';
import {SignUpComponent} from './sign-up/sign-up.component';
import {LogInComponent} from './log-in/log-in.component';
import {ApproveComponent} from './approve/approve.component';
import {LogInSeedComponent} from './log-in-seed/log-in-seed.component';
import {GoogleComponent} from './auth/google/google.component';
import { EmbedComponent } from './embed/embed.component';
import { HomeComponent } from './home/home.component';
import { LogoutComponent } from './logout/logout.component';
import { SignUpComponent } from './sign-up/sign-up.component';
import { LogInComponent } from './log-in/log-in.component';
import { ClearAccountComponent } from './clear-account/clear-account.component';
import { ApproveComponent } from './approve/approve.component';
import { LogInSeedComponent } from './log-in-seed/log-in-seed.component';
import { GoogleComponent } from './auth/google/google.component';

export class RouteNames {
public static EMBED = 'embed';
public static LOGOUT = 'logout';
public static SIGN_UP = 'sign-up';
public static CLEAR_ACCOUNT = 'clear-account';
public static LOG_IN = 'log-in';
public static LOAD_SEED = 'load-seed';
public static APPROVE = 'approve';
Expand All @@ -25,13 +27,26 @@ const routes: Routes = [
{ path: RouteNames.LOGOUT, component: LogoutComponent, pathMatch: 'full' },
{ path: RouteNames.SIGN_UP, component: SignUpComponent, pathMatch: 'full' },
{ path: RouteNames.LOG_IN, component: LogInComponent, pathMatch: 'full' },
{ path: RouteNames.LOAD_SEED, component: LogInSeedComponent, pathMatch: 'full' },
{
path: RouteNames.CLEAR_ACCOUNT,
component: ClearAccountComponent,
pathMatch: 'full',
},
{
path: RouteNames.LOAD_SEED,
component: LogInSeedComponent,
pathMatch: 'full',
},
{ path: RouteNames.APPROVE, component: ApproveComponent, pathMatch: 'full' },
{ path: RouteNames.AUTH_GOOGLE, component: GoogleComponent, pathMatch: 'full' },
{
path: RouteNames.AUTH_GOOGLE,
component: GoogleComponent,
pathMatch: 'full',
},
];

@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
exports: [RouterModule],
})
export class AppRoutingModule { }
export class AppRoutingModule {}
27 changes: 12 additions & 15 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { EmbedComponent } from './embed/embed.component';
import { HomeComponent } from './home/home.component';
import {FormsModule} from '@angular/forms';
import {IdentityService} from './identity.service';
import {CookieModule} from 'ngx-cookie';
import { FormsModule } from '@angular/forms';
import { IdentityService } from './identity.service';
import { CookieModule } from 'ngx-cookie';
import { LogoutComponent } from './logout/logout.component';
import { BannerComponent } from './banner/banner.component';
import { SignUpComponent } from './sign-up/sign-up.component';
import {AccountService} from './account.service';
import {EntropyService} from './entropy.service';
import { AccountService } from './account.service';
import { EntropyService } from './entropy.service';
import { LogInComponent } from './log-in/log-in.component';
import {HttpClientModule} from '@angular/common/http';
import { ClearAccountComponent } from './clear-account/clear-account.component';
import { HttpClientModule } from '@angular/common/http';
import { ApproveComponent } from './approve/approve.component';
import { LogInSeedComponent } from './log-in-seed/log-in-seed.component';
import { GoogleComponent } from './auth/google/google.component';
Expand All @@ -29,6 +29,7 @@ import { AvatarDirective } from './avatar/avatar.directive';
BannerComponent,
SignUpComponent,
LogInComponent,
ClearAccountComponent,
ApproveComponent,
LogInSeedComponent,
GoogleComponent,
Expand All @@ -39,13 +40,9 @@ import { AvatarDirective } from './avatar/avatar.directive';
HttpClientModule,
AppRoutingModule,
FormsModule,
CookieModule.forRoot()
],
providers: [
IdentityService,
EntropyService,
AccountService,
CookieModule.forRoot(),
],
bootstrap: [AppComponent]
providers: [IdentityService, EntropyService, AccountService],
bootstrap: [AppComponent],
})
export class AppModule { }
export class AppModule {}
56 changes: 56 additions & 0 deletions src/app/clear-account/clear-account.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<app-banner></app-banner>

<div
class="container home-container"
*ngIf="globalVars.inTab || globalVars.webview"
>
<div class="font-weight-bold fs-30px mb-20px">Clear Login Data</div>
Copy link
Author

@akutch akutch Jul 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the verbiage here from wipe --> clear since I felt like it reads and looks better. I can certainly change it back if we want to stick with wipe, though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think "Clear" is a better choice here. Let's stick with your change.

<div class="fs-15px">
Confirming this step will remove your login data from your browser. If you
use a seedphrase to login to your account, make sure you have recorded this
securely.
</div>
<div class="fc-red fs-18px pt-15px">
Enter "<b>I understand log me out</b>" to confirm you want to clear your
login data.
</div>
<div class="form-group pt-10px">
<textarea
[(ngModel)]="clearAccountCheck"
class="form-control fs-15px"
rows="4"
></textarea>
</div>
<div class="d-flex align-items-center" style="margin-top: -15px">
<div class="fs-12px mt-15px text-grey6">
By proceeding, you agree that you will need to re-enter your seed phrase
on login to access your account.
</div>
</div>
<div class="d-flex pt-15px justify-content-between">
<button
class="btn btn-outline-primary font-weight-bold fs-15px sign-up-btn"
[routerLink]="['/log-in']"
>
Back
</button>
<div>
<button
*ngIf="clearAccountCheck == 'I understand log me out'"
(click)="clearAccounts()"
class="btn btn-primary font-weight-bold fs-15px ml-10px sign-up-btn"
[routerLink]="['/log-in']"
>
Confirm
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also changed this button text from Next --> Confirm to match the above "Confirming this step will.." phrasing

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

</button>
<!-- Show blocked button if text entered does not equal required text-->
<button
*ngIf="clearAccountCheck !== 'I understand log me out'"
class="btn btn-primary font-weight-bold fs-15px ml-10px sign-up-btn"
disabled
>
Confirm
</button>
</div>
</div>
</div>
Empty file.
24 changes: 24 additions & 0 deletions src/app/clear-account/clear-account.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { ClearAccountComponent } from './clear-account.component';

describe('ClearAccountComponent', () => {
let component: ClearAccountComponent;
let fixture: ComponentFixture<ClearAccountComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ClearAccountComponent],
}).compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(ClearAccountComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
28 changes: 28 additions & 0 deletions src/app/clear-account/clear-account.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Component } from '@angular/core';
import { AccountService } from '../account.service';
import { GlobalVarsService } from '../global-vars.service';

@Component({
selector: 'app-clear-account',
templateUrl: './clear-account.component.html',
styleUrls: ['./clear-account.component.scss'],
})
export class ClearAccountComponent {
clearAccountCheck = '';

constructor(
private accountService: AccountService,
public globalVars: GlobalVarsService
) {}

clearAccounts(): void {
const publicKeys = this.accountService.getPublicKeys();
for (const key of publicKeys) {
this.accountService.deleteUser(key);
}
}

clearAccountsCancel(): void {
this.clearAccountCheck = '';
}
}
86 changes: 73 additions & 13 deletions src/app/log-in/log-in.component.html
Original file line number Diff line number Diff line change
@@ -1,28 +1,61 @@
<app-banner></app-banner>

<div class="container home-container" *ngIf="globalVars.inTab || globalVars.webview">
<div
class="container home-container"
*ngIf="globalVars.inTab || globalVars.webview"
>
<div class="font-weight-bold fs-30px mb-20px">
Log in to {{ globalVars.hostname }}
</div>

<div class="row">
<div class="d-flex flex-column col-sm-6" *ngIf="hasUsers">
<ul class="list-group mt-7px mb-30px">
<li *ngFor="let item of allUsers | keyvalue" class="list-group-item list-group-item-action cursor-pointer" (click)="selectAccount(item.key)">
<li
*ngFor="let item of allUsers | keyvalue"
class="list-group-item list-group-item-action cursor-pointer"
(click)="selectAccount(item.key)"
>
<div class="w-100">
<div *ngIf="!item.value.username" class="text-truncate">{{ item.key }}&hellip;</div>
<div *ngIf="!item.value.username" class="text-truncate">
{{ item.key }}&hellip;
</div>
<div *ngIf="item.value.username" class="d-flex align-items-center">
<div class="avatar mr-15px" [appAvatar]="item.key"></div>
<div
class="avatar mr-15px"
[style.background-image]="'url(' + item.value.profilePic + ')'"
></div>
<div class="text-truncate">{{ item.value.username }}</div>
</div>
</div>
</li>
</ul>
</div>
<div class="d-flex align-items-center flex-column" [class.col-sm-6]="hasUsers" [class.col-sm-12]="!hasUsers">
<button class="btn btn-default log-in-google mb-30px" (click)="launchGoogle()" *ngIf="!globalVars.hideGoogle"></button>
<button class="btn btn-default log-in-seed" [routerLink]="['/load-seed']"></button>
<button class="btn btn-default sign-up-seed" [routerLink]="['/sign-up']"></button>
<div
class="d-flex align-items-center flex-column"
[class.col-sm-6]="hasUsers"
[class.col-sm-12]="!hasUsers"
>
<button
class="btn btn-default log-in-google mb-30px"
(click)="launchGoogle()"
*ngIf="!globalVars.hideGoogle"
></button>
<button
class="btn btn-default log-in-seed"
[routerLink]="['/load-seed']"
></button>
<button
class="btn btn-default sign-up-seed"
[routerLink]="['/sign-up']"
></button>
<button
*ngIf="hasUsers"
class="btn btn-default log-in-clear-data mt-30px"
[routerLink]="['/clear-account']"
>
Clear Login Data
</button>
</div>
</div>

Expand All @@ -36,21 +69,48 @@
<span *ngIf="globalVars.accessLevelRequest >= 2">✅</span>
<span *ngIf="globalVars.accessLevelRequest < 2">❌</span>
My basic information
<div class="fs-14px text-muted"><b>{{ globalVars.hostname }}</b> can access my public key and any other public information</div>
<div class="fs-14px text-muted">
<b>{{ globalVars.hostname }}</b> can access my public key and any
other public information
</div>
</li>
<li class="list-group-item">
<span *ngIf="globalVars.accessLevelRequest >= 3">✅</span>
<span *ngIf="globalVars.accessLevelRequest < 3">❌</span>
Post, message, like, and follow on my behalf
<div class="fs-14px text-muted" *ngIf="globalVars.accessLevelRequest < 3"><b>{{ globalVars.hostname }}</b> will require approval to post, message, like, and follow</div>
<div class="fs-14px text-muted" *ngIf="globalVars.accessLevelRequest >= 3"><b>{{ globalVars.hostname }}</b> may post, message, like, and follow without requiring approval</div>
<div
class="fs-14px text-muted"
*ngIf="globalVars.accessLevelRequest < 3"
>
<b>{{ globalVars.hostname }}</b> will require approval to post,
message, like, and follow
</div>
<div
class="fs-14px text-muted"
*ngIf="globalVars.accessLevelRequest >= 3"
>
<b>{{ globalVars.hostname }}</b> may post, message, like, and follow
without requiring approval
</div>
</li>
<li class="list-group-item">
<span *ngIf="globalVars.accessLevelRequest === 4">✅</span>
<span *ngIf="globalVars.accessLevelRequest < 4">❌</span>
Buy, sell, and send coins on my behalf
<div class="fs-14px text-muted" *ngIf="globalVars.accessLevelRequest < 4"><b>{{ globalVars.hostname }}</b> will require approval to buy, sell, or send coins</div>
<div class="fs-14px text-muted" *ngIf="globalVars.accessLevelRequest === 4"><b>{{ globalVars.hostname }}</b> may buy, sell, and send coins without requiring approval</div>
<div
class="fs-14px text-muted"
*ngIf="globalVars.accessLevelRequest < 4"
>
<b>{{ globalVars.hostname }}</b> will require approval to buy, sell,
or send coins
</div>
<div
class="fs-14px text-muted"
*ngIf="globalVars.accessLevelRequest === 4"
>
<b>{{ globalVars.hostname }}</b> may buy, sell, and send coins without
requiring approval
</div>
</li>
</ul>
</div>
Expand Down
23 changes: 23 additions & 0 deletions src/app/log-in/log-in.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.log-in-clear-data {
text-decoration: underline;
}

.log-in-google,
.log-in-seed,
.sign-up-seed {
height: 72px;
width: 290px;
background-size: 290px 72px;
}

.log-in-google {
background-image: url(/assets/log_in_google.png);
}

.log-in-seed {
background-image: url(/assets/log_in_seed.png);
}

.sign-up-seed {
background-image: url(/assets/sign_up_seed.png);
}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved most of these over from styles.scss since they're only used for login

Loading