Skip to content

Commit

Permalink
Warn users when account is in a bugged state
Browse files Browse the repository at this point in the history
  • Loading branch information
duncte123 committed Jan 31, 2025
1 parent 58e2f98 commit e9bfbbc
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 79 deletions.
1 change: 1 addition & 0 deletions src/app/marathon/selection/selection.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ <h4 class="subtitle is-4">{{ 'marathon.selection.selection.title' | translate}}<
<select [(ngModel)]="selection[category.id].status" name="status-{{category.id}}">
<option value="TODO">{{ 'marathon.selection.status.TODO' | translate}}</option>
<option value="REJECTED">{{ 'marathon.selection.status.REJECTED' | translate}}</option>
<option *ngIf="marathonId.startsWith('uksg')" value="" disabled>Third option</option>
<option value="BONUS">{{ 'marathon.selection.status.BONUS' | translate}}</option>
<option value="BACKUP">{{ 'marathon.selection.status.BACKUP' | translate}}</option>
<option value="VALIDATED">{{ 'marathon.selection.status.VALIDATED' | translate}}</option>
Expand Down
4 changes: 4 additions & 0 deletions src/app/marathon/selection/selection.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,4 +258,8 @@ export class SelectionComponent implements OnInit {
get title(): string {
return 'Select Runs';
}

get marathonId() {
return this.marathonService.marathon.id.toLowerCase();
}
}
57 changes: 4 additions & 53 deletions src/app/user/new-user/new-user.component.html
Original file line number Diff line number Diff line change
@@ -1,56 +1,7 @@
<div class="container">
<h1 class="title">{{'user.settings.new.beforeWeStart' | translate}}</h1>
<h2 class="subtitle">{{'user.settings.new.description' | translate}}</h2>
<h1 class="title">WARNING!</h1>
<h2 class="subtitle">Please contact an admin</h2>

<form ngForm="newUserForm"
(ngSubmit)="submit()"
#form="ngForm">
<div class="field">
<label class="label">{{'user.settings.username.label' | translate}}</label>
<div class="control">
<input class="input"
[ngClass]="{'is-danger': username.invalid}"
type="text"
[(ngModel)]="user.username"
name="username"
#username="ngModel"
minlength="3"
maxlength="32"
pattern="^[\w\-]{3,32}$"
appUsernameExistsValidator
required>
</div>
<div *ngIf="username.invalid">
<p class="help is-danger"
*ngIf="username.errors.minlength">{{'user.settings.username.error.min' | translate}}</p>
<p class="help is-danger"
*ngIf="username.errors.maxlength">{{'user.settings.username.error.max' | translate}}</p>
<p class="help is-danger"
*ngIf="username.errors.exists">{{'user.settings.username.error.exists' | translate}}</p>
<p class="help is-danger"
*ngIf="username.errors.required">{{'user.settings.username.error.required' | translate}}</p>
<p class="help is-danger"
*ngIf="username.errors.pattern">{{'user.settings.username.error.pattern' | translate}}</p>
</div>
</div>
<div class="field">
<label class="label">{{'user.settings.email.label' | translate}}</label>
<div class="control">
<input class="input" [ngClass]="{'is-danger': mail.invalid}" type="email" [(ngModel)]="user.email" name="mail"
#mail="ngModel" email required>
</div>
<div *ngIf="mail.invalid">
<p class="help is-danger" *ngIf="mail.errors.email">{{'user.settings.email.error.email' | translate}}</p>
<p class="help is-danger" *ngIf="mail.errors.required">{{'user.settings.email.error.required' | translate}}</p>
</div>
</div>
<div class="field">
<div class="control">
<button class="button is-link"
[ngClass]="{'is-loading': loading}"
type="submit"
[disabled]="form.invalid">{{'action.submit' | translate}}</button>
</div>
</div>
</form>
<p>If you see this it means your account is bugged, please join our discord to get your account fixed.</p>
<p>The link for the discord is in the menu bar at the top of the page.</p>
</div>
29 changes: 3 additions & 26 deletions src/app/user/new-user/new-user.component.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,12 @@
import { Component, OnInit } from '@angular/core';
import { User } from '../../../model/user';
import { UserService } from '../../../services/user.service';
import { Router } from '@angular/router';
import { Component } from '@angular/core';

@Component({
selector: 'app-new-user',
templateUrl: './new-user.component.html',
styleUrls: ['./new-user.component.css']
})
export class NewUserComponent implements OnInit {

public user: User;
public loading = false;

constructor(public userService: UserService, private router: Router) {
}

ngOnInit() {
this.user = {...this.userService.user};
}

submit() {
this.loading = true;
this.user.displayName = this.user.username;
this.userService.update(this.user).add(() => {
this.loading = false;
this.router.navigate(['/']);
});
}

export class NewUserComponent {
get title(): string {
return 'Sign Up';
return 'Invalid account state!';
}
}

0 comments on commit e9bfbbc

Please sign in to comment.