pineafan | 4627016 | 2022-02-13 12:06:17 +0000 | [diff] [blame] | 1 | import { Component } from 'react'; |
| 2 | import Styles from '../../styles/rsmv/rsmv.module.css' |
| 3 | import HCaptcha from 'react-hcaptcha'; |
| 4 | import Axios from 'axios'; |
| 5 | import Router from 'next/router'; |
| 6 | import React from 'react'; |
| 7 | import Header from '../../Components/Header' |
| 8 | |
| 9 | import { AutoLayout, Panel, Title, Subtitle, Text, Divider } from '../../Components/Panels'; |
| 10 | import { List, ListItem, Code } from '../../Components/Texttools'; |
| 11 | class RSMV extends Component { |
| 12 | |
| 13 | constructor(props) { |
| 14 | super(props); |
| 15 | this.v = false; |
| 16 | this.state = { |
| 17 | captchaComplete: false, |
| 18 | clicked: false |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | async handleVerificationSuccess(cls, token) { |
| 23 | const chk = await Axios.put('/api/rsmv/verifyTkn', { tkn: token.toString() }) |
pineafan | 9babd75 | 2022-10-21 21:47:52 +0100 | [diff] [blame] | 24 | if(chk.data.success === true) { |
pineafan | 4627016 | 2022-02-13 12:06:17 +0000 | [diff] [blame] | 25 | this.setState({ |
| 26 | captchaComplete: true |
| 27 | }) |
| 28 | return cls.v = true; |
| 29 | } else { |
| 30 | return; |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | async submitForm(cls) { |
| 35 | if ( cls.state.clicked ) { |
| 36 | return |
| 37 | } |
| 38 | cls.setState({ |
| 39 | clicked: true |
| 40 | }) |
| 41 | if (!cls.v) { |
| 42 | return Router.push('/rsmv/failure','/rsmv') |
| 43 | } |
| 44 | let code = await Axios.post('/api/rsmv/complete', { |
| 45 | uid:cls.props.uID, |
| 46 | rid:cls.props.rID, |
| 47 | gid:cls.props.gID, |
| 48 | code:cls.props.code |
| 49 | }); |
pineafan | 4627016 | 2022-02-13 12:06:17 +0000 | [diff] [blame] | 50 | if (code.status === 200 ) return Router.push('/rsmv/success','/rsmv') |
| 51 | else return Router.push('/rsmv/failure','/rsmv') |
| 52 | } |
| 53 | |
| 54 | render() { |
| 55 | return <> |
| 56 | <Header |
| 57 | name={ |
| 58 | <> |
| 59 | <img alt="Server icon" style={{borderRadius: "50%", height: "64px", width: "auto"}} src={"https://i1.sndcdn.com/artworks-000045941811-q634od-t500x500.jpg"} /> |
| 60 | <br /> |
| 61 | {"ERROR"} |
| 62 | </> |
| 63 | } |
| 64 | nameOverwrite="Verify" |
| 65 | subtext={`-5 members`} |
| 66 | gradient={["F27878", "D96B6B"]} |
| 67 | wave="web/waves/header/rsm" |
| 68 | buttons={[]} |
PineaFan | a465f35 | 2023-02-05 16:45:01 +0000 | [diff] [blame] | 69 | season={this.props.season} |
pineafan | 4627016 | 2022-02-13 12:06:17 +0000 | [diff] [blame] | 70 | /> |
pineafan | 4627016 | 2022-02-13 12:06:17 +0000 | [diff] [blame] | 71 | <AutoLayout> |
| 72 | <Panel> |
| 73 | <Text>Complete the check below to join ERROR</Text> |
| 74 | <div style={{height: "125px"}}> |
| 75 | <HCaptcha |
| 76 | id="Captchas mitigate problems" |
| 77 | sitekey="85074411-fa13-4d9b-b901-53095c6d1fc6" |
| 78 | onVerify={token => this.handleVerificationSuccess(this, token)} |
| 79 | theme={this.theme ? "light" : "dark"} |
| 80 | /> |
| 81 | </div> |
| 82 | <button type="button" className={Styles.button + " " + (this.state.captchaComplete ? Styles.buttonComplete : null)} onClick={(success) => this.submitForm(this)}>Proceed</button> |
| 83 | <List colour="F27878"> |
| 84 | <ListItem>This is an automatic check performed by RSM.</ListItem> |
| 85 | <ListItem>By clicking Proceed, you will be given the <code>MISSING</code> role in <code>ERROR</code>.</ListItem> |
PineaFan | 4141862 | 2023-10-14 21:36:48 +0100 | [diff] [blame^] | 86 | <ListItem>For the full list of data stored by RSM, please check <a href="https://clickscodes.github.io/policies/rsm#verification">Here</a></ListItem> |
pineafan | 4627016 | 2022-02-13 12:06:17 +0000 | [diff] [blame] | 87 | </List> |
| 88 | <Text>You can add RSM to your server by inviting it <a href="https://discord.com/api/oauth2/authorize?client_id=715989276382462053&permissions=121295465718&scope=bot%20applications.commands">here</a>.</Text> |
| 89 | </Panel> |
| 90 | </AutoLayout> |
| 91 | </> |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | export default RSMV; |