From 1089c742bafb8dff026f3cd8be882ca397f4f2aa Mon Sep 17 00:00:00 2001 From: SuperMax <141626084+iamsupermax@users.noreply.github.com> Date: Sun, 13 Oct 2024 16:13:35 +0200 Subject: [PATCH] trytomoveforward --- app/Validators/EmailValidator.ts | 2 +- app/Validators/RegisterValidator.ts | 3 +-- app/Validators/UsernameValidator.ts | 2 +- database/migrations/1692371621634_users.ts | 3 +-- database/seeders/Apps.ts | 16 +++++++++++++ database/seeders/User.ts | 9 +++++++ resources/scss/layout/_auth.scss | 28 ++++++---------------- resources/scss/styles.scss | 5 ++++ resources/views/auth/login.edge | 14 ++++++----- resources/views/auth/register.edge | 18 +++++++------- start/routes.ts | 18 +++++--------- 11 files changed, 65 insertions(+), 53 deletions(-) create mode 100644 database/seeders/Apps.ts create mode 100644 database/seeders/User.ts diff --git a/app/Validators/EmailValidator.ts b/app/Validators/EmailValidator.ts index 2554a0e..d2ea020 100644 --- a/app/Validators/EmailValidator.ts +++ b/app/Validators/EmailValidator.ts @@ -6,7 +6,7 @@ export default class EmailValidator { public schema = schema.create({ email: schema.string({}, [ - rules.email(), + rules.email() ]), }) diff --git a/app/Validators/RegisterValidator.ts b/app/Validators/RegisterValidator.ts index 86f0fe3..18862be 100644 --- a/app/Validators/RegisterValidator.ts +++ b/app/Validators/RegisterValidator.ts @@ -17,10 +17,9 @@ export default class RegisterValidator { password: schema.string({}, [ rules.confirmed(), rules.minLength(8), - rules.maxLength(50), + rules.maxLength(50) ]) }) public messages: CustomMessages = {} } - diff --git a/app/Validators/UsernameValidator.ts b/app/Validators/UsernameValidator.ts index b58df64..0ce12ca 100644 --- a/app/Validators/UsernameValidator.ts +++ b/app/Validators/UsernameValidator.ts @@ -8,7 +8,7 @@ export default class UsernameValidator { rules.regex(/^[a-zA-Z0-9_.]+$/), // all upper and lower case + all figures + ._ rules.minLength(3), rules.maxLength(20), - rules.unique({ table: 'users', column: 'username' }), + rules.unique({ table: 'users', column: 'username' }) ]) }) diff --git a/database/migrations/1692371621634_users.ts b/database/migrations/1692371621634_users.ts index 655e2e2..30d5387 100644 --- a/database/migrations/1692371621634_users.ts +++ b/database/migrations/1692371621634_users.ts @@ -6,8 +6,7 @@ export default class extends BaseSchema { public async up() { this.schema.createTable(this.tableName, (table) => { - table.increments('id') - + table.increments('id'), table.string('username', 128).notNullable().unique() table.string('email', 255).notNullable().unique() table.string('password', 180).notNullable() diff --git a/database/seeders/Apps.ts b/database/seeders/Apps.ts new file mode 100644 index 0000000..b30c9f4 --- /dev/null +++ b/database/seeders/Apps.ts @@ -0,0 +1,16 @@ +import BaseSeeder from '@ioc:Adonis/Lucid/Seeder' +import App, {AppCategory} from 'App/Models/App' + +export default class extends BaseSeeder { + public async run () { + const app = await App.create({ + userId: 1, + name: "test app", + desc: "test app descr", + releases: "0.1.0", + source_url: "https://github.com/paxo-phone/paxo-site", + category: AppCategory.OTHER, + }) + app.save() + } +} \ No newline at end of file diff --git a/database/seeders/User.ts b/database/seeders/User.ts new file mode 100644 index 0000000..cad17c3 --- /dev/null +++ b/database/seeders/User.ts @@ -0,0 +1,9 @@ +import BaseSeeder from '@ioc:Adonis/Lucid/Seeder' +import User from 'App/Models/User' + +export default class extends BaseSeeder { + public async run () { + const user = await User.create({id: 1, username: 'test', email: 'test@example.com', password: 'password', type: 0}); + user.save() + } +} \ No newline at end of file diff --git a/resources/scss/layout/_auth.scss b/resources/scss/layout/_auth.scss index 8ee3690..856c2cb 100644 --- a/resources/scss/layout/_auth.scss +++ b/resources/scss/layout/_auth.scss @@ -1,15 +1,14 @@ +.form-div{ + padding-top: 135px; +} + .h2-form { font-size: 25px; color: #39BC9B; - margin: auto; text-align: center; - margin-top: 100px; } -.form-auth{ - padding: 2rem; - width:5vh; -} + input:not([type=file]), textarea, select { padding: 2vh; @@ -18,20 +17,7 @@ input:not([type=file]), textarea, select { margin: 10px; } -/* -.breakup { - width: 11%; - padding: 1px; - margin: auto; - margin-top: 2%; - margin-bottom: 2%; - background-color: rgba(0, 0, 0, 0.1) -}*/ - -// TOFIX: triggers header display bug. Must be precised -// i{ -// height:100vh; -// } + .btn-submit, .btn-account { font-size: 16px; margin-top: 1rem; @@ -92,7 +78,7 @@ input:not([type=file]), textarea, select { } .arrow { - border: solid black; + border: solid #39BC9B; border-width: 0 3px 3px 0; display: inline-block; padding: 3px; diff --git a/resources/scss/styles.scss b/resources/scss/styles.scss index bca010c..a0e45ec 100644 --- a/resources/scss/styles.scss +++ b/resources/scss/styles.scss @@ -10,12 +10,17 @@ @import 'module/banner'; @import 'module/form'; @import 'module/project'; +@import 'module/apps'; +@import 'module/markdown'; // layout +@import 'layout/auth'; @import 'layout/header'; @import 'layout/block'; @import 'layout/container'; @import 'layout/footer'; +@import 'layout/sidebar'; + // utils @import 'utils/utils'; diff --git a/resources/views/auth/login.edge b/resources/views/auth/login.edge index 0f7038a..6882e5f 100644 --- a/resources/views/auth/login.edge +++ b/resources/views/auth/login.edge @@ -5,10 +5,12 @@ Log in @endsection @section('content') -
Connectez-vous
- +Connectez-vous
+ +Enregistrez-vous
- + @endsection \ No newline at end of file diff --git a/start/routes.ts b/start/routes.ts index c3d4bbf..1549219 100644 --- a/start/routes.ts +++ b/start/routes.ts @@ -21,7 +21,6 @@ import Route from '@ioc:Adonis/Core/Route' import User, { UserType } from 'App/Models/User' import type { HttpContextContract } from '@ioc:Adonis/Core/HttpContext' - /** * ---------------------------------------------- * Main routes @@ -38,7 +37,6 @@ Route.group(() => { Route.get('tedx', 'RedirectionsController.tedx') }) - /** * ---------------------------------------------- * Tutorials @@ -50,7 +48,7 @@ Route.group(() => { Route.get('/t/:id/view', 'TutorialsController.viewStep').as('tutorials.viewStep') Route.get('/t/:id/end', 'TutorialsController.stepEnd').as('tutorials.stepEnd') }) - .prefix('/tutorials') + .prefix('/tutorials').as('tutorials') // ---------------------------------------------- // Marketplace @@ -73,7 +71,7 @@ Route.group(() => { } }).prefix('/apps') .middleware('silentAuth') - + // ---------------------------------------------- // Auth // ---------------------------------------------- @@ -92,7 +90,7 @@ Route.group(() => { .as('auth.logoutProcess') .middleware("auth") }).prefix('/auth') - + // ---------------------------------------------- // Dashboard @@ -108,10 +106,8 @@ Route.group(() => { Route.post('/profile', 'DashboardController.editProfile') .as('dash.profile.edit') }).prefix('/edit') -}) +}).prefix('/dashboard').as('dash') .middleware('auth') - .as('dash') - /** * ---------------------------------------------- * Admin panel @@ -142,7 +138,7 @@ Route.group(() => { }) .middleware(['auth', 'authAdmin']) .prefix('/admin-panel') - + /** * ---------------------------------------------- * Development environment @@ -168,7 +164,6 @@ if (process.env.NODE_ENV == "development") { }) } - /** * ---------------------------------------------- * Legal @@ -178,5 +173,4 @@ Route.group(() => { Route.get('/', 'LegalController.index').as('legal.index') Route.get('/:slug', 'LegalController.view').as('legal.viewLegalDoc') }) - .prefix('/legal') - + .prefix('/legal').as('legal')