Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
rahafjrw committed Sep 18, 2024
1 parent 3442c1a commit 8173603
Show file tree
Hide file tree
Showing 9 changed files with 163 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Sources/App/Controllers/Authentication/LoginController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//
// File.swift
//
//
// Created by Rahaf Aljerwi on 9/16/24.
//

import Foundation
16 changes: 16 additions & 0 deletions Sources/App/Controllers/Authentication/PortalController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// PortalController.swift
//
//


import Fluent
import Plot
import Vapor

enum PortalController {
@Sendable
static func show(req: Request) async throws -> HTML {
return Portal.View(path: req.url.path).document()
}
}
8 changes: 8 additions & 0 deletions Sources/App/Controllers/Authentication/SignupController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//
// File.swift
//
//
// Created by Rahaf Aljerwi on 9/14/24.
//

import Foundation
8 changes: 8 additions & 0 deletions Sources/App/Controllers/Authentication/VerifyController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//
// File.swift
//
//
// Created by Rahaf Aljerwi on 9/15/24.
//

import Foundation
91 changes: 91 additions & 0 deletions Sources/App/Views/Authentication/Login+View.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
//
// PortalView.swift
//
//

import Plot
import Foundation

enum Portal {

class View: PublicPage {

// let model: Model

// init(path: String, model: Model) {
// self.model = model
// super.init(path: path)
// }

override func pageTitle() -> String? {
"Portal"
}

override func content() -> Node<HTML.BodyContext> {
.div(
.h2("Login"),
.loginForm(),
.h2("Dont have an account?"),
.signupButton()
)
}
}
}

// move to other file later
extension Portal {
struct Model {
var email: String
var password: String
}
}

// move to plot extensions later
extension Node where Context: HTML.BodyContext {
static func loginForm(email: String = "", password: String = "") -> Self {
.form(
.action(SiteURL.portal.relativeURL()),

Check failure on line 47 in Sources/App/Views/Authentication/Login+View.swift

View workflow job for this annotation

GitHub Actions / Test

type 'SiteURL' has no member 'portal'

Check failure on line 47 in Sources/App/Views/Authentication/Login+View.swift

View workflow job for this annotation

GitHub Actions / Test

type 'SiteURL' has no member 'portal'

Check failure on line 47 in Sources/App/Views/Authentication/Login+View.swift

View workflow job for this annotation

GitHub Actions / Test

type 'SiteURL' has no member 'portal'

Check failure on line 47 in Sources/App/Views/Authentication/Login+View.swift

View workflow job for this annotation

GitHub Actions / Test

type 'SiteURL' has no member 'portal'

Check failure on line 47 in Sources/App/Views/Authentication/Login+View.swift

View workflow job for this annotation

GitHub Actions / Test

type 'SiteURL' has no member 'portal'
.loginField(email: email),
.passwordField(password: password),
.button(
.type(.submit)
)
)
}

static func signupButton() -> Self {
.form(
.action(SiteURL.signup.relativeURL()),

Check failure on line 58 in Sources/App/Views/Authentication/Login+View.swift

View workflow job for this annotation

GitHub Actions / Test

type 'SiteURL' has no member 'signup'

Check failure on line 58 in Sources/App/Views/Authentication/Login+View.swift

View workflow job for this annotation

GitHub Actions / Test

type 'SiteURL' has no member 'signup'

Check failure on line 58 in Sources/App/Views/Authentication/Login+View.swift

View workflow job for this annotation

GitHub Actions / Test

type 'SiteURL' has no member 'signup'

Check failure on line 58 in Sources/App/Views/Authentication/Login+View.swift

View workflow job for this annotation

GitHub Actions / Test

type 'SiteURL' has no member 'signup'

Check failure on line 58 in Sources/App/Views/Authentication/Login+View.swift

View workflow job for this annotation

GitHub Actions / Test

type 'SiteURL' has no member 'signup'
.button(
.type(.submit)
)
)
}
}

extension Node where Context == HTML.FormContext {
static func loginField(email: String = "") -> Self {
.input(
.id("email"),
.name("email"),
.type(.email),
.placeholder("Enter email"),
.spellcheck(false),
.autocomplete(false),
.value(email)
)
}

static func passwordField(password: String = "") -> Self {
.input(
.id("password"),
.name("password"),
.type(.password),
.placeholder("Enter password"),
.spellcheck(false),
.autocomplete(false),
.value(password)
)
}
}

8 changes: 8 additions & 0 deletions Sources/App/Views/Authentication/Portal+View.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//
// File.swift
//
//
// Created by Rahaf Aljerwi on 9/16/24.
//

import Foundation
8 changes: 8 additions & 0 deletions Sources/App/Views/Authentication/Signup+View.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//
// File 2.swift
//
//
// Created by Rahaf Aljerwi on 9/14/24.
//

import Foundation
8 changes: 8 additions & 0 deletions Sources/App/Views/Authentication/Verify+View.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//
// File 2.swift
//
//
// Created by Rahaf Aljerwi on 9/16/24.
//

import Foundation
8 changes: 8 additions & 0 deletions Sources/Cognito/Cognito.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//
// File.swift
//
//
// Created by Rahaf Aljerwi on 9/15/24.
//

import Foundation

0 comments on commit 8173603

Please sign in to comment.