-
Notifications
You must be signed in to change notification settings - Fork 3
feat: authentication flow #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
EdroCode
wants to merge
11
commits into
main
Choose a base branch
from
pc/signInUpMigrations
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
2ce3a48
feat:authentication flow
EdroCode fa2e25d
fix:test
EdroCode 1defc8b
feat: update auth pages with hero icons and password toggle
EdroCode ac4fa23
Merge branch 'main' into pc/signInUpMigrations
EdroCode 313f55d
Merge branch 'main' into pc/signInUpMigrations
EdroCode 985a0dd
feat:add auth layout
EdroCode e9fe0e2
fix:tests
EdroCode 7086900
feat:show password and responivity
EdroCode cee0846
fix:alias
EdroCode 80a1905
fix:alias
EdroCode 68844d0
feat:navbar layout and landing-page added
EdroCode File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -40,4 +40,4 @@ module.exports = plugin(function({matchComponents, theme}) { | |
| } | ||
| } | ||
| }, {values}) | ||
| }) | ||
| }) | ||
This file contains hidden or 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,26 @@ | ||
| defmodule Yearbook.User do | ||
| @moduledoc """ | ||
| Yearbook's user module | ||
| """ | ||
| use Ecto.Schema | ||
| import Ecto.Changeset | ||
|
|
||
| @primary_key {:id, :binary_id, autogenerate: true} | ||
| @foreign_key_type :binary_id | ||
| schema "users" do | ||
| field :name, :string | ||
| field :description, :string | ||
| field :email, :string | ||
| field :year, Ecto.Enum, values: [:"3rd", :"5th"] | ||
| field :password, :string | ||
|
|
||
| timestamps(type: :utc_datetime) | ||
| end | ||
|
|
||
| @doc false | ||
| def changeset(user, attrs) do | ||
| user | ||
| |> cast(attrs, [:name, :email, :year, :password]) | ||
| |> validate_required([:name, :email, :year, :password]) | ||
| end | ||
| end | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,30 @@ | ||
| <div class="flex flex-col relative w-full justify-between min-h-screen "> | ||
| <img | ||
| src="/images/background/0.png" | ||
| class="absolute inset-0 h-full w-full object-cover opacity-100 z-0 " | ||
| alt="background" | ||
| /> | ||
| <div class="flex flex-col w-full h-full z-10 place-items-between min-h-screen"> | ||
| <div class="flex relative w-full h-auto"> | ||
| <div class="bg-white/30 m-4 w-auto backdrop-blur-md p-3 rounded-2xl hover:scale-102 transition-transform hover:bg-white/50"> | ||
| <a href="/" class="flex items-center gap-3 cursor-pointer"> | ||
| <span class="hero-academic-cap text-black h-8 w-8"></span> | ||
| <span class="text-2xl font-bold text-black">YEARBOOK</span> | ||
| </a> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div class="flex grow md:place-items-center "> | ||
| {@inner_content} | ||
| </div> | ||
|
|
||
| <div class="flex relative w-full h-auto justify-center md:justify-start align-bottom mt-2"> | ||
| <a href="https://cesium.di.uminho.pt/en" class="m-3 cursor-default "> | ||
| <img | ||
| src="/images/cesium.svg" | ||
| class="h-10 w-10 cursor-pointer hover:scale-105 transition-transform " | ||
| /> | ||
| </a> | ||
| </div> | ||
| </div> | ||
| </div> |
This file contains hidden or 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,23 @@ | ||
| <div class="h-screen w-full"> | ||
| <div class="bg-white flex items-center justify-between w-full h-20 px-4 border-b-3 border-primary "> | ||
| <div class="flex z-10 justify-between h-full items-center"> | ||
| <div class="p-3 rounded-2xl "> | ||
| <a href="/" class="flex items-center gap-3 cursor-pointer"> | ||
| <span class="hero-academic-cap text-black h-8 w-8"></span> | ||
| <span class="text-2xl font-bold text-black">YEARBOOK</span> | ||
| </a> | ||
| </div> | ||
| </div> | ||
| <div class="flex items-center gap-2"> | ||
| <a href="/signup"> | ||
| <.button variant="secondary" class="w-32 h-10 border-primary ">Sign Up</.button> | ||
| </a> | ||
| <a href="/signin"> | ||
| <.button variant="secondary" class="w-32 h-10 border-primary">Sign In</.button> | ||
| </a> | ||
| </div> | ||
| </div> | ||
| <div class="flex grow md:place-items-center "> | ||
| {@inner_content} | ||
| </div> | ||
| </div> |
This file contains hidden or 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 hidden or 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,11 @@ | ||
| defmodule YearbookWeb.ForgotPassword.Index do | ||
| @moduledoc """ | ||
| Forgot password | ||
| """ | ||
| use YearbookWeb, :auth_view | ||
|
|
||
| def mount(_params, _session, socket) do | ||
| socket = assign(socket, page_title: "Forgot Password | Yearbook") | ||
| {:ok, socket} | ||
| end | ||
| end |
This file contains hidden or 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,53 @@ | ||
| <div class=" z-10 flex justify-end items-center grow h-full my-auto"> | ||
| <div class="flex flex-col justify-stretch sm:justify-between bg-white h-auto w-full md:w-150 sm:h-100 rounded-2xl py-8 px-5 sm:p-8 mr-5 ml-5 my-auto"> | ||
| <div class="flex-col"> | ||
| <div class="flex-col"> | ||
| <a | ||
| class="inline-flex items-center cursor-pointer hover:scale-105 transition-all" | ||
| href="/signin" | ||
| > | ||
| <span class="hero-arrow-left text-black h-5"></span> | ||
| <p class="text-primary">Back</p> | ||
| </a> | ||
|
|
||
| <div class="flex items-center"> | ||
| <span class="hero-key text-black mt-5 mr-2"></span> | ||
| <h1 class="text-3xl font-bold tracking-normal ml-2 mt-6 mb-1 text-black"> | ||
| Forgot Password | ||
| </h1> | ||
| </div> | ||
| </div> | ||
| <div class="flex-col"> | ||
| <p class="pt-2 text-black"> | ||
| Did you forget your password? | ||
| </p> | ||
| <p class="pt-2 text-black"> | ||
| Try entering your email here to reset your password | ||
| </p> | ||
| </div> | ||
| </div> | ||
| <div class="flex flex-col"> | ||
| <div class="mb-2 mt-4"> | ||
| <label class="text-black font-semibold mb-2 mt-2">Email</label> | ||
| <div class="flex border border-gray-300 rounded mt-2 px-3 py-2 h-13"> | ||
| <span class="hero-at-symbol text-black content-center my-auto mr-2 "></span> | ||
|
|
||
| <input | ||
| type="email" | ||
| class="text-black w-full outline-none " | ||
| placeholder="Email" | ||
| name="email" | ||
| /> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <div class="flex flex-col"> | ||
| <.button | ||
| class="h-12 w-full hover:scale-101 transition-transform bg-primary rounded " | ||
| variant="primary" | ||
| > | ||
| Submit | ||
| </.button> | ||
| </div> | ||
| </div> | ||
| </div> |
This file contains hidden or 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,12 @@ | ||
| defmodule YearbookWeb.LandingPage.Index do | ||
| use YearbookWeb, :navbar | ||
|
|
||
| @moduledoc """ | ||
| Landing Page | ||
| """ | ||
| def mount(_params, _session, socket) do | ||
| {:ok, | ||
| socket | ||
| |> assign(page_title: "Home | Yearbook")} | ||
| end | ||
| end |
This file contains hidden or 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,7 @@ | ||
| <div class="flex flex-col relative w-full justify-between min-h-screen "> | ||
| <img | ||
| src="/images/background/0.png" | ||
| class="absolute inset-0 h-full w-full object-cover opacity-100 z-0 " | ||
| alt="background" | ||
| /> | ||
| </div> |
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,74 @@ | ||
| defmodule YearbookWeb.SignInLive.FormComponent do | ||
| use YearbookWeb, :live_component | ||
|
|
||
| alias Phoenix.HTML.FormData | ||
|
|
||
| @impl true | ||
| @spec render(any()) :: Phoenix.LiveView.Rendered.t() | ||
| def render(assigns) do | ||
| ~H""" | ||
| <div> | ||
| <.form for={@form} phx-change="validate" phx-target={@myself}> | ||
| <div class="mb-2 mt-4"> | ||
| <label class="text-black font-semibold mb-2 mt-4">Password</label> | ||
| <div class="flex items-center border border-gray-300 rounded px-3 py-2 mb-4 mt-2 h-13"> | ||
| <span class="hero-key text-black content-center my-auto mr-2"></span> | ||
| <%= if @password_visible do %> | ||
| <div class="grid w-full h-full grid-cols-[auto_1rem] justify-stretch py-1 pr-2"> | ||
| <.input | ||
| type="text" | ||
| class="text-black w-full outline-none" | ||
| placeholder="Password" | ||
| field={@form["password"]} | ||
| /> | ||
| <span | ||
| id="toggle-eye-password" | ||
| class="hero-eye-slash text-black cursor-pointer my-auto hover:scale-110 transition-transform self-end" | ||
| phx-click="toggle_password" | ||
| phx-target={@myself} | ||
| > | ||
| </span> | ||
| </div> | ||
| <% else %> | ||
| <div class="grid w-full h-full grid-cols-[auto_1rem] justify-stretch py-1 pr-2"> | ||
| <.input | ||
| type="password" | ||
| class="text-black w-full outline-none" | ||
| placeholder="Password" | ||
| field={@form["password"]} | ||
| /> | ||
| <span | ||
| id="toggle-eye-password" | ||
| class="hero-eye text-black cursor-pointer my-auto hover:scale-110 transition-transform" | ||
| phx-click="toggle_password" | ||
| phx-target={@myself} | ||
| > | ||
| </span> | ||
| </div> | ||
| <% end %> | ||
| </div> | ||
| </div> | ||
| </.form> | ||
| </div> | ||
| """ | ||
| end | ||
|
|
||
| @impl true | ||
| def update(assigns, socket) do | ||
| {:ok, | ||
| socket | ||
| |> assign(assigns) | ||
| |> assign_new(:password_visible, fn -> false end)} | ||
| end | ||
|
|
||
| @impl true | ||
| def handle_event("toggle_password", _params, socket) do | ||
| {:noreply, assign(socket, :password_visible, !socket.assigns.password_visible)} | ||
| end | ||
|
|
||
| def handle_event("validate", %{"auth" => form}, socket) do | ||
| {:noreply, | ||
| socket | ||
| |> assign(form: FormData.to_form(%{"password" => form["password"]}, as: :auth))} | ||
| end | ||
| end |
This file contains hidden or 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,12 @@ | ||
| defmodule YearbookWeb.SignInLive.Index do | ||
| use YearbookWeb, :auth_view | ||
|
|
||
| alias Phoenix.HTML.FormData | ||
|
|
||
| def mount(_params, _session, socket) do | ||
| {:ok, | ||
| socket | ||
| |> assign(page_title: "Sign In | Yearbook") | ||
| |> assign(form: FormData.to_form(%{"password" => ""}, as: :auth))} | ||
| end | ||
| end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.