import React, { useState } from 'react'; import { Route, Link } from 'react-router-dom'; import './light.css'; import { Container, Form, Header, Image, Message, Segment } from 'semantic-ui-react'; import { requester } from './utils.js'; export function AuthForm(props) { const { user } = props; const username = user ? user.username : ''; const [input, setInput] = useState({ username: username }); const [error, setError] = useState({}); const [success, setSuccess] = useState(false); const [loading, setLoading] = useState(false); const handleValues = (e, v) => setInput({ ...input, [v.name]: v.value }); const handleChange = (e) => handleValues(e, e.currentTarget); const handleSubmit = (e) => { if (input.username.includes('@')) { setError({ username: 'Spaceport username, not email.' }); } else { if (loading) return; setLoading(true); const data = { ...input, username: input.username.toLowerCase() }; requester('/spaceport-auth/login/', 'POST', '', data) .then(res => { setSuccess(true); setError({}); }) .catch(err => { setLoading(false); console.log(err); setError(err.data); }); } }; return ( success ? props.children :
Click here to reset it.
would like to request Spaceport authentication.
URL: wiki.protospace.ca
You can now log into the Wiki:
{user &&
Username: {user.member.mediawiki_username || user.username}
Password: [this Spaceport password]
would like to request Spaceport authentication.
URL: forum.protospace.ca
You can now log into the Discourse:
{user &&
Username: {user.member.discourse_username || user.username}
Password: [this Spaceport password]
Use this page to link different applications to your Spaceport account.