Archived following merge with main
The code in this repository picks up from the progress done during the encode hack submission of this project. i.e All work stemming from this commit
During the apac hackathon, the following improvements were made to our platform:
- Inclusion of an auth system - username and password
- User profiles and a gallery page of the projects
These have been organised into respective polkadot-apac-hackathon folders.
This has been moved to substrate-template
The goals are split into the following sections:
- Route protection for stage 2 and above in review modal - require auth.
- Include user profile route based on web3 address as pulled from chain.
- Include the gallery page.
- Complete signup form that collects name, web3 address and, optionally, password
- Setup react router for the login to redirect to last page
- Complete
useAuthState
hook to check with server and implement further guards for jwt auth. - Develop multicurrency selector for collateralisation and use in a stage of the submit review modal- requires types from chain.
- Add in hcaptcha component for forms optional, ref could be made to flips instead.
- setup docs detailing the distinct feature added and code separation for moderators
Reference server-guide for more info, or lmk.
Only goals 1, 2, 4, 5,6,8 and 9 were achieved for this hackathon.
-
Route protection can be obtained by doing auth check before switch statement and not in individual components. The hook itself can be polyfilled on the client while the actual endpoint is being developed on server
-
Each review object coming from the chain has the
ownerId
as the public key of the writer, hence this address serves as a good id for the respective profiles. Since the key is stored on the db, further metadata can be pulled. -
For user profile, the components with styling are ready here Note: doen't show review on click yet , all's left is to wire it up with the respective data and fill-in metadata with db on the server
-
Rerouting for login and signup can make use of [react-router]'s
useNavigate
hook to retain memory of last route before login/signup -
for access to substrate rpc calls, the api promise interface is used with methods mapping each section -
queries
,extrinsics
and the like.Provided by the [useSubstrate
] hook from the [substrateProvider
]. Further notes on api here
Note: TxButton is a useful interface currently used to handle calls to api.tx
As listed out by the hasura tutorial, owasp provides a concrete way of preventing xss after the prereq of csrf protection that jwts and refresh tokens provide.
One such is disallowing any untrusted data injection.
- An example is react router route params