Skip to content

Commit

Permalink
trytomoveforward
Browse files Browse the repository at this point in the history
  • Loading branch information
iamsupermax committed Oct 13, 2024
1 parent c89ef8a commit 1089c74
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 53 deletions.
2 changes: 1 addition & 1 deletion app/Validators/EmailValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default class EmailValidator {

public schema = schema.create({
email: schema.string({}, [
rules.email(),
rules.email()
]),
})

Expand Down
3 changes: 1 addition & 2 deletions app/Validators/RegisterValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
}

2 changes: 1 addition & 1 deletion app/Validators/UsernameValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' })
])
})

Expand Down
3 changes: 1 addition & 2 deletions database/migrations/1692371621634_users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
16 changes: 16 additions & 0 deletions database/seeders/Apps.ts
Original file line number Diff line number Diff line change
@@ -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()
}
}
9 changes: 9 additions & 0 deletions database/seeders/User.ts
Original file line number Diff line number Diff line change
@@ -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: '[email protected]', password: 'password', type: 0});
user.save()
}
}
28 changes: 7 additions & 21 deletions resources/scss/layout/_auth.scss
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions resources/scss/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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';
14 changes: 8 additions & 6 deletions resources/views/auth/login.edge
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ Log in
@endsection

@section('content')
<p class="h2-form">Connectez-vous</p>
<form method="post" enctype="multipart/form-data" class="form-auth">
<input type="text" name="login" placeholder="Username / email" required>
<input type="password" name="password" placeholder="Password" required>
<button type="submit" class="btn btn-submit">Log in</button>
</form>
<section class="form-div">
<p class="h2-form">Connectez-vous</p>
<form method="post" enctype="multipart/form-data">
<input type="text" name="login" placeholder="Username / email" required>
<input type="password" name="password" placeholder="Password" required>
<button type="submit" class="btn btn-submit">Log in</button>
</form>
</section>
@endsection
18 changes: 10 additions & 8 deletions resources/views/auth/register.edge
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@ Register
@endsection

@section('content')
<p class="h2-form">Enregistrez-vous</p>
<form method="post" enctype="multipart/form-data" class="form-auth">
<input type="text" name="username" placeholder="Username" value="" required />
<section class="form-div" style="margin-top: 100px; padding-top:100px">
<p class="h2-form">Enregistrez-vous</p>
<form method="post" enctype="multipart/form-data">
<input type="text" name="username" placeholder="Username" value="" required />

<input type="text" name="email" placeholder="Email" value="" required />
<input type="text" name="email" placeholder="Email" value="" required />

<input type="password" name="password" placeholder="Password" required />
<input type="password" name="password" placeholder="Password" required />

<input type="password" name="password_confirmation" placeholder="Repeat password" required />
<input type="password" name="password_confirmation" placeholder="Repeat password" required />

<button class="btn btn-submit">Register</button>
</form>
<button class="btn btn-submit">Register</button>
</form>
</section>
@endsection
18 changes: 6 additions & 12 deletions start/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -38,7 +37,6 @@ Route.group(() => {

Route.get('tedx', 'RedirectionsController.tedx')
})

/**
* ----------------------------------------------
* Tutorials
Expand All @@ -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
Expand All @@ -73,7 +71,7 @@ Route.group(() => {
}
}).prefix('/apps')
.middleware('silentAuth')

// ----------------------------------------------
// Auth
// ----------------------------------------------
Expand All @@ -92,7 +90,7 @@ Route.group(() => {
.as('auth.logoutProcess')
.middleware("auth")
}).prefix('/auth')


// ----------------------------------------------
// Dashboard
Expand All @@ -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
Expand Down Expand Up @@ -142,7 +138,7 @@ Route.group(() => {
})
.middleware(['auth', 'authAdmin'])
.prefix('/admin-panel')

/**
* ----------------------------------------------
* Development environment
Expand All @@ -168,7 +164,6 @@ if (process.env.NODE_ENV == "development") {
})

}

/**
* ----------------------------------------------
* Legal
Expand All @@ -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')

0 comments on commit 1089c74

Please sign in to comment.