-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new backend functionalities (e.g. changed session flow, reset pas…
…sword, confirm email) and start cleaning up the project a bit.
- Loading branch information
1 parent
ae5bcb5
commit 026a56a
Showing
94 changed files
with
1,256 additions
and
518 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
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
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,22 @@ | ||
import { ErrorCode } from '../../interfaces/error-code.enum'; | ||
|
||
export function getErrorMessage(error: any): string { | ||
const errorCode = getErrorCode(error); | ||
return errorCode || 'AN_UNEXPECTED_ERROR_OCCURRED'; | ||
} | ||
|
||
export function getErrorCode(error: any): ErrorCode { | ||
if (error.error) { | ||
try { | ||
// Errors from backend currently come sometimes as string, sometimes as object | ||
const errorObject = | ||
typeof error.error === 'string' ? JSON.parse(error.error) : error.error; | ||
if (errorObject.type === 'destrostudios') { | ||
return errorObject.code; | ||
} | ||
} catch (e) { | ||
// Ignore | ||
} | ||
} | ||
return null; | ||
} |
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,9 @@ | ||
import * as bcrypt from 'bcryptjs'; | ||
|
||
export function generateSalt(): string { | ||
return bcrypt.genSaltSync(10); | ||
} | ||
|
||
export function hashSecret(secret: string, salt: string): string { | ||
return bcrypt.hashSync(secret, salt); | ||
} |
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
src/app/model/app-files-response.model.ts → ...nterfaces/app-files-response.interface.ts
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
4 changes: 2 additions & 2 deletions
4
src/app/model/app.model.ts → src/app/interfaces/app.interface.ts
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
File renamed without changes.
File renamed without changes.
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,14 @@ | ||
export enum ErrorCode { | ||
APP_ALREADY_ADDED = 'APP_ALREADY_ADDED', | ||
APP_FILE_NOT_FOUND = 'APP_FILE_NOT_FOUND', | ||
APP_NOT_ADDED = 'APP_NOT_ADDED', | ||
APP_NOT_FOUND = 'APP_NOT_FOUND', | ||
BAD_REQUEST = 'BAD_REQUEST', | ||
EMAIL_ALREADY_EXISTS = 'EMAIL_ALREADY_EXISTS', | ||
EMAIL_NOT_CONFIRMED = 'EMAIL_NOT_CONFIRMED', | ||
LOGIN_ALREADY_EXISTS = 'LOGIN_ALREADY_EXISTS', | ||
TOO_MANY_EMAIL_REQUESTS = 'TOO_MANY_EMAIL_REQUESTS', | ||
USER_NOT_FOUND = 'USER_NOT_FOUND', | ||
WRONG_EMAIL_SECRET = 'WRONG_EMAIL_SECRET', | ||
WRONG_PASSWORD = 'WRONG_PASSWORD', | ||
} |
Oops, something went wrong.