-
-
Notifications
You must be signed in to change notification settings - Fork 5
[WIP] Add authentication workflow #49
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
bupemulenga13
wants to merge
6
commits into
Digital-Prophets:main
Choose a base branch
from
bupemulenga13:add-authentication-workflow
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 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5915ac4
Add custom routing and logging
bupemulenga13 78ede69
Add Auth Context to app
bupemulenga13 95a2214
Fixed Layout and made PR changes requested
bupemulenga13 90f0b5b
Add Registration Functionality to authentication workflow
bupemulenga13 d1c1f99
Set cookie authentication to login functionality
bupemulenga13 7c1f401
Merge with Upstream branch dashboard components
bupemulenga13 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,3 @@ | ||
| import React from 'react'; | ||
|
|
||
| export default function Footer() { | ||
| return ( | ||
| <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
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,5 @@ | ||
| const config = { | ||
| defaults: { namespace: 'app' }, | ||
| }; | ||
|
|
||
| export default config; |
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,54 @@ | ||
| import config from './config'; | ||
|
|
||
| const DEFAULT_NAMESPACE = config.defaults.namespace; | ||
|
|
||
| const getDate = () => { | ||
| return new Date().toISOString(); | ||
| }; | ||
|
|
||
| const info = (message: any, namespace?: string) => { | ||
| if (typeof message === 'string') { | ||
| console.log( | ||
| `[${getDate()}] [${namespace || DEFAULT_NAMESPACE}] [INFO] ${message}` | ||
| ); | ||
| } else { | ||
| console.log( | ||
| `[${getDate()}] [${namespace || DEFAULT_NAMESPACE}] [INFO]`, | ||
| message | ||
| ); | ||
| } | ||
| }; | ||
|
|
||
| const warn = (message: any, namespace?: string) => { | ||
| if (typeof message === 'string') { | ||
| console.log( | ||
| `[${getDate()}] [${namespace || DEFAULT_NAMESPACE}] [WARN] ${message}` | ||
| ); | ||
| } else { | ||
| console.log( | ||
| `[${getDate()}] [${namespace || DEFAULT_NAMESPACE}] [WARN]`, | ||
| message | ||
| ); | ||
| } | ||
| }; | ||
|
|
||
| const error = (message: any, namespace?: string) => { | ||
| if (typeof message === 'string') { | ||
| console.log( | ||
| `[${getDate()}] [${namespace || DEFAULT_NAMESPACE}] [ERROR] ${message}` | ||
| ); | ||
| } else { | ||
| console.log( | ||
| `[${getDate()}] [${namespace || DEFAULT_NAMESPACE}] [ERROR]`, | ||
| message | ||
| ); | ||
| } | ||
| }; | ||
|
|
||
| const logging = { | ||
| info, | ||
| warn, | ||
| error, | ||
| }; | ||
|
|
||
| export default logging; |
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,60 @@ | ||
| import IRoutes from '../interfaces/routes'; | ||
| import Agents from '../pages/agents'; | ||
| import Beneficiary from '../pages/beneficiary/index'; | ||
| import Dashboard from '../pages/dashboard'; | ||
| import Location from '../pages/location'; | ||
| import Occupation from '../pages/occupation'; | ||
| import Users from '../pages/users'; | ||
|
|
||
| const routes: IRoutes[] = [ | ||
| { | ||
| path: '/dashboard', | ||
| name: 'Dashboard Page', | ||
| component: Dashboard, | ||
| exact: true, | ||
| }, | ||
| { | ||
| path: '/beneficiary/index', | ||
| name: 'Beneficiary Page', | ||
| component: Beneficiary, | ||
| exact: true, | ||
| }, | ||
| { | ||
| path: '/location', | ||
| name: 'Location Page', | ||
| component: Location, | ||
| exact: true, | ||
| }, | ||
| { | ||
| path: '/occuoation', | ||
| name: 'Occupation Page', | ||
| component: Occupation, | ||
| exact: true, | ||
| }, | ||
| { | ||
| path: '/agents', | ||
| name: 'Agents Page', | ||
| component: Agents, | ||
| exact: true, | ||
| }, | ||
| { | ||
| path: '/users', | ||
| name: 'User Management Page', | ||
| component: Users, | ||
| exact: true, | ||
| }, | ||
| { | ||
| path: '/auth/login', | ||
sonlinux marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| name: 'Login Page', | ||
| component: 'User Management Component', | ||
| exact: true, | ||
| }, | ||
| { | ||
| path: '/auth/registration', | ||
sonlinux marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| name: 'User Management Page', | ||
| component: 'User Management Component', | ||
| exact: true, | ||
| }, | ||
| ]; | ||
|
|
||
| export default routes; | ||
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 @@ | ||
| export default interface IRoutes { | ||
| path: string; | ||
| name: string; | ||
| component: any; | ||
| exact: boolean; | ||
| props?: any; | ||
| } |
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,73 @@ | ||
| import { LockOpenIcon } from '@heroicons/react/outline'; | ||
| import Image from 'next/image'; | ||
| import { useRouter } from 'next/router'; | ||
|
|
||
| import mainLogo from '../../assets/undp-logo.png'; | ||
|
|
||
| export default function Login() { | ||
| const router = useRouter(); | ||
| return ( | ||
| <div className="min-h-full flex items-center justify-center py-12 px-4 sm:px-6 lg:px-8 "> | ||
| <form className="bg-white shadow-md rounded px-8 pt-6 pb-8 mb-4 ml-2 justify-center"> | ||
| <div className="mb-6"> | ||
| <h6 className="mt-6 text-center text-3xl font-bold text-gray-900"> | ||
| Welcome | ||
| </h6> | ||
| <div className="flex justify-center mt-4"> | ||
| <Image className="object-contain" src={mainLogo} /> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div className="grid grid-rows-1 grid-flow-row mb-8"> | ||
| <div className="mb-2"> | ||
| <label | ||
| className="block text-gray-700 text-sm font-bold mb-2" | ||
| htmlFor="email" | ||
| > | ||
| </label> | ||
| <input | ||
| className="shadow appearance-none border w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline focus:bg-white" | ||
| id="email" | ||
| type="text" | ||
| placeholder="Email" | ||
| /> | ||
| </div> | ||
| </div> | ||
| <div className="grid grid-rows-1 grid-flow-row mb-8"> | ||
| <label | ||
| className="block text-gray-700 text-sm font-bold mb-2" | ||
| htmlFor="password" | ||
| > | ||
| Password | ||
| </label> | ||
| <input | ||
| className="shadow appearance-none border w-full py-2 px-3 text-gray-700 mb-3 leading-tight focus:outline-none focus:shadow-outline focus:bg-white" | ||
| id="password" | ||
| type="password" | ||
| placeholder="******************" | ||
| /> | ||
| </div> | ||
|
|
||
| <div> | ||
| <button | ||
| type="submit" | ||
| className="group relative w-full flex justify-center py-2 px-4 border border-transparent text-sm font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500" | ||
| onSubmit={() => { | ||
| router.push('/dashboard'); | ||
| console.log('submit'); | ||
| }} | ||
| > | ||
| <span className="absolute left-0 inset-y-0 flex items-center pl-3"> | ||
| <LockOpenIcon | ||
| className="h-5 w-5 text-indigo-500 group-hover:text-indigo-400" | ||
| aria-hidden="true" | ||
| /> | ||
| </span> | ||
| Login | ||
| </button> | ||
| </div> | ||
| </form> | ||
| </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
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 |
|---|---|---|
| @@ -1,11 +1,15 @@ | ||
| import React from 'react'; | ||
|
|
||
| export default function Users() { | ||
| return ( | ||
| <div className="main-content flex flex-col flex-grow p-4"> | ||
| <h1 className="font-bold text-2xl text-gray-700">Users</h1> | ||
| <div className="flex pt-4 pl-4 justify-between"> | ||
| <div className="flex"> | ||
| <h1 className="font-bold text-2xl text-gray-700">Users</h1> | ||
| </div> | ||
|
|
||
| <div className="flex flex-col flex-grow border-4 border-gray-400 border-dashed bg-white rounded mt-4"></div> | ||
| <div className="flex space-x-4 text-gray-400 mr-3"> | ||
| <button className="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 mr-8 rounded"> | ||
| Add User | ||
| </button> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
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.