Skip to content
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

s #33

Open
wants to merge 57 commits into
base: main
Choose a base branch
from
Open

s #33

wants to merge 57 commits into from

Conversation

Venkatesh-4
Copy link

No description provided.

Venkatesh-4 and others added 30 commits April 8, 2024 16:54
Mainly the database part and added params to blog page and slug page
Done is such a way that if an existing connection exists then that will be used, otherwise a new connection is created.
Created userSchema and postSchema. Function to handle existing user and posts also written
functions to get all posts, single post, single user and all users
Dynamic image, title and description on single post page.
Dynamic image and slug for the post card component
postUser component username detail altered to reflect the DB schema.
Changed the find fucntion to findOne to get single post as find was returning an array
Moved avatar handling from single post page to postUser component. Included dynamic date.
Added necessary css for detail text and value.
Added nessesary avatar css.
Sorted out page title and description. This shows up in the head tag and is useful when people search for my website.
Managed to add a post to the data base through the use of a form
Issue with the id of the freshly added post using the test page. the userId must apparently match the _id as part of mongoDB schema
Added get and post method to the API endpoint file. Wrote a function to handle logging into GitHub. Used a button to facilitate the login. Used a session variable to console log the session details. Added get and post handlers to the nest auth function
Moved the function that handle loggin in to GitHub into action.js. Also wrote a function to handle logging out.
Initialized the session object within the NavBar component and passed it as a prop to the links component.
Since links has the useState hook it can be an async function. Changed the isAdmin to make it dynamic, it checks the session object to identify the same.
callback function written check the data base if the user logged on through GitHub exists, if not add the user to the users table.
altered the users table model to change the password field from being mandatory to facilitate the addition of user data when logged on through GitHub
Moved login page into (auth) folder to keep all the authentication related pages together.
Created a register page and added some styling to it.
Wrote a function for the registration form in action.js which saves the registered account in the database, it checks if the user already exists first.
Installed bcrypt.
Used a bcrypt function to hash the password during registration. In the DB is hashed password is saved.
Uninstalled bcrypt and insalled bcryptjs.
Added a form to login using credentials.
Login function written in action.js.
A credentials provider function that acts as a means to authorize the user was written in auth.js.
loginpage -> action.js -> auth.js
Modified the register function to return the error object.
Created a separate component for the registration form, since it is a client side component.
Using the useFormState hook the error messages are dynamically displayed.
Issue with the useEffect hook. after registration is a success the login page isn't automatically redirected into
Automatic redirection is fixed
Login form converted into a component.
Styles added to login form and page
Nothing is being fetched in the login page, hence we can remove async.
dynamic message returned for invalid username or password.
next redirect automatically trows an error, to handle that we have written throw err
Using middleware to restrict the access to other pages from the login page.
Right now other pages aren't accessible since the authorized function returns false
when logging in using credentials we the auth object now contails the id and isAdmin as well.
Wrote out authorization conditions for the admin panel, blog page, and the login page.
Redirects based on the authorization function was also handled
Created function to add user and delete user
Admin page structure along with components created
Altered source in the case of missing images.
coded up adminUsers component to fetch user data.
Issue-changes not reflecting in the blog page
Since admin post from  and admin user form require the userId, it is passed as an attribute to both these components.

Admin post form component is complete, the userId is passed as a prop, through a hidden field in the form
Admin user form component created
Added style to the individual components and also to the admin dashboard as a whole.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant