-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
212 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Simple script that helps me copy translations and save our translators some time if I'm just copying. | ||
|
||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
const rootDir = path.resolve(__dirname, 'src', 'assets', 'i18n'); | ||
const jsonFiles = fs.readdirSync(rootDir).filter((file) => file.endsWith('.json')); | ||
|
||
for (const file of jsonFiles) { | ||
const filePath = path.resolve(rootDir, file); | ||
const json = fs.readFileSync(filePath, 'utf8'); | ||
const obj = JSON.parse(json); | ||
|
||
if (obj.navbar?.login?.discord) { | ||
obj.login = { ...obj.login }; | ||
obj.login.provider = {...obj.login.provider }; | ||
|
||
obj.login.provider.discord = obj.navbar.login.discord; | ||
} | ||
|
||
if (obj.navbar?.login?.twitch) { | ||
obj.login = { ...obj.login }; | ||
obj.login.provider = {...obj.login.provider }; | ||
|
||
obj.login.provider.twitch = obj.navbar.login.twitch; | ||
} | ||
|
||
if (obj.navbar?.login?.google) { | ||
obj.login = { ...obj.login }; | ||
obj.login.provider = {...obj.login.provider }; | ||
|
||
obj.login.provider.google = obj.navbar.login.google; | ||
} | ||
|
||
fs.writeFileSync(filePath, JSON.stringify(obj, null, 2)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,90 @@ | ||
<section class="section container"> | ||
<h1 class="title">Log-in to your Oengus account</h1> | ||
<h1 class="title">{{ 'login.title' | translate }}</h1> | ||
|
||
<div class="notification" *ngIf="loginError == 'USERNAME_PASSWORD_INCORRECT'"> | ||
<button class="delete" (click)="loginError = null"></button> | ||
Lorem ipsum dolor sit amet, consectetur | ||
adipiscing elit lorem ipsum dolor. <strong>Pellentesque risus mi</strong>, tempus quis placerat ut, porta nec nulla. Vestibulum rhoncus ac ex sit amet fringilla. Nullam gravida purus diam, et dictum <a>felis venenatis</a> efficitur. | ||
</div> | ||
|
||
<div class="columns"> | ||
<div class="column is-three-fifths is-offset-one-fifth"> | ||
<form action=""> | ||
|
||
<div class="field"> | ||
<label class="label">Username</label> | ||
<div class="control has-icons-left"> | ||
<input class="input" type="text" placeholder="OengusIO" name="username" [disabled]="loading" [(ngModel)]="loginData.username"> | ||
<span class="icon is-small is-left"> | ||
<fieldset [disabled]="loading"> | ||
<div class="field"> | ||
<label class="label">{{ 'user.settings.username.label' | translate }}</label> | ||
<div class="control has-icons-left"> | ||
<input class="input" type="text" placeholder="OengusIO" name="username" [(ngModel)]="loginData.username"> | ||
<span class="icon is-small is-left"> | ||
<fa-icon [icon]="iconUser"></fa-icon> | ||
</span> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
|
||
<label class="label">Password</label> | ||
<div class="field has-addons"> | ||
<div class="control has-icons-left is-expanded"> | ||
<input class="input" type="password" name="password" placeholder="********" [disabled]="loading" *ngIf="passwordHidden; else plainTextPw" [(ngModel)]="loginData.password"> | ||
<ng-template #plainTextPw> | ||
<input class="input" type="text" name="password" placeholder="password" [disabled]="loading" [(ngModel)]="loginData.password"> | ||
</ng-template> | ||
<span class="icon is-small is-left"> | ||
<label class="label">{{ 'user.settings.password.label' | translate }}</label> | ||
<div class="field has-addons"> | ||
<div class="control has-icons-left is-expanded"> | ||
<input class="input" type="password" name="password" placeholder="********" *ngIf="passwordHidden; else plainTextPw" [(ngModel)]="loginData.password"> | ||
<ng-template #plainTextPw> | ||
<input class="input" type="text" name="password" placeholder="password" [(ngModel)]="loginData.password"> | ||
</ng-template> | ||
<span class="icon is-small is-left"> | ||
<fa-icon [icon]="iconPadlock"></fa-icon> | ||
</span> | ||
</div> | ||
</div> | ||
|
||
<div class="control"> | ||
<button class="button" [disabled]="loading" (click)="passwordHidden = !passwordHidden"> | ||
<div class="control"> | ||
<button class="button" (click)="passwordHidden = !passwordHidden"> | ||
<span class="icon cursor-pointer"> | ||
<fa-icon [icon]="iconEye" *ngIf="passwordHidden; else eyeSlash"></fa-icon> | ||
<fa-icon [title]="'login.password.show' | translate" [icon]="iconEye" *ngIf="passwordHidden; else eyeSlash"></fa-icon> | ||
<ng-template #eyeSlash> | ||
<fa-icon [icon]="iconEyeSlash"></fa-icon> | ||
</ng-template> | ||
</span> | ||
</button> | ||
</button> | ||
</div> | ||
</div> | ||
|
||
<div class="field" *ngIf="mfaNeeded"> | ||
<label class="label">{{ 'login.2fa.label' | translate }}</label> | ||
<div class="control"> | ||
<input class="input" type="text" placeholder="000000" name="2fa" [(ngModel)]="loginData.twoFactorCode" /> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="control"> | ||
<button type="submit" style="margin-right: 1rem" | ||
[ngClass]="{'is-loading': loading}" | ||
(click)="performLogin()" | ||
class="button is-primary">{{'action.login' | translate}}</button> | ||
</div> | ||
<div class="control"> | ||
<button type="submit" style="margin-right: 1rem" | ||
[ngClass]="{'is-loading': loading}" | ||
(click)="performLogin()" | ||
class="button is-primary">{{'login.button' | translate}}</button> | ||
</div> | ||
</fieldset> | ||
|
||
</form> | ||
</div> | ||
</div> | ||
|
||
<hr/> | ||
<h2 class="subtitle"> | ||
Log-in with a provider | ||
{{ 'login.provider.title' | translate }} | ||
</h2> | ||
|
||
<div class="columns"> | ||
<div class="column is-one-fifth is-offset-3"> | ||
<button class="button">Discord</button> | ||
</div> | ||
<div class="column is-one-fifth"> | ||
<button class="button">Twitch</button> | ||
</div> | ||
<div class="buttons is-centered are-large"> | ||
<a [href]="userService.getDiscordAuthUri()" class="button is-discord"> | ||
<span class="icon"> | ||
<fa-icon [icon]="iconDiscord"></fa-icon> | ||
</span> | ||
<span>{{ 'login.provider.discord' | translate }}</span> | ||
</a> | ||
<a [href]="userService.getTwitchAuthUrl()" class="button is-twitch"> | ||
<span class="icon"> | ||
<fa-icon [icon]="iconTwitch"></fa-icon> | ||
</span> | ||
<span>{{ 'login.provider.twitch' | translate }}</span> | ||
</a> | ||
<!--<button class="button is-static"> | ||
{{ 'login.provider.google' | translate }} | ||
</button>--> | ||
</div> | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule i18n
updated
from 779b65 to 9831d9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
@use 'sass:color' as color; | ||
|
||
.button.is-twitch { | ||
color: white; | ||
border-color: white; | ||
background-color: $twitchPurple; | ||
|
||
&:hover { | ||
background-color: color.scale($twitchPurple, $saturation: -40%); | ||
} | ||
} | ||
.button.is-discord { | ||
color: white; | ||
border-color: white; | ||
background-color: $discordBlurple; | ||
|
||
&:hover { | ||
background-color: color.scale($discordBlurple, $saturation: -40%); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
export interface LoginDetails { | ||
username: string; | ||
password: string; | ||
twoFactorCode: string | null; | ||
} | ||
|
||
export interface LoginResponse { | ||
token: string | null; | ||
status: LoginResponseStatus; | ||
} | ||
|
||
export enum LoginResponseStatus { | ||
MFA_REQUIRED = 'MFA_REQUIRED', | ||
MFA_INVALID = 'MFA_INVALID', | ||
LOGIN_SUCCESS = 'LOGIN_SUCCESS', | ||
USERNAME_PASSWORD_INCORRECT = 'USERNAME_PASSWORD_INCORRECT', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { HttpClient, HttpParams } from '@angular/common/http'; | ||
import { NwbAlertService } from '@wizishop/ng-wizi-bulma'; | ||
import { Router } from '@angular/router'; | ||
import { Observable } from 'rxjs'; | ||
import { BaseService } from './BaseService'; | ||
import { LoginDetails, LoginResponse } from '../model/auth'; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class AuthService extends BaseService { | ||
|
||
constructor(private http: HttpClient, | ||
private router: Router, | ||
toastr: NwbAlertService) { | ||
super(toastr, 'auth'); | ||
} | ||
|
||
performLogin(details: LoginDetails): Observable<LoginResponse> { | ||
details.twoFactorCode = details.twoFactorCode || null; | ||
|
||
return this.http.post<LoginResponse>(this.url('login', 'v2'), details); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters