mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Support Registration on Webatrice with a baseline of handling. (#4436)
* Support Registration on Webatrice with a baseline of handling. Still needs to support activation tokens & unit testing. * Add support for account activation with token * Activate Account refactor * Fix typo * Add Unit Testing for Commands/Events * Changes based on review feedback
This commit is contained in:
parent
ebebb9c4bb
commit
b1ef8220ee
14 changed files with 483 additions and 68 deletions
|
|
@ -76,7 +76,7 @@ class Account extends Component<AccountProps> {
|
|||
<Paper className="account-details" style={{margin: "0 0 5px 0"}}>
|
||||
<img src={url} alt={name} />
|
||||
<p><strong>{name}</strong></p>
|
||||
<p>Location: ({country.toUpperCase()})</p>
|
||||
<p>Location: ({country?.toUpperCase()})</p>
|
||||
<p>User Level: {userLevel}</p>
|
||||
<p>Account Age: {accountageSecs}</p>
|
||||
<p>Real Name: {realName}</p>
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ class Server extends Component<ServerProps, ServerState> {
|
|||
this.showDescription = this.showDescription.bind(this);
|
||||
this.showRegisterForm = this.showRegisterForm.bind(this);
|
||||
this.hideRegisterForm = this.hideRegisterForm.bind(this);
|
||||
this.onRegister = this.onRegister.bind(this);
|
||||
|
||||
this.state = {
|
||||
register: false
|
||||
|
|
@ -47,10 +46,6 @@ class Server extends Component<ServerProps, ServerState> {
|
|||
this.setState({register: false});
|
||||
}
|
||||
|
||||
onRegister(fields) {
|
||||
console.log("register", fields);
|
||||
}
|
||||
|
||||
render() {
|
||||
const { message, rooms, joinedRooms, history, state, description, users } = this.props;
|
||||
const { register } = this.state;
|
||||
|
|
@ -66,7 +61,7 @@ class Server extends Component<ServerProps, ServerState> {
|
|||
<Paper className="server-connect__form">
|
||||
{
|
||||
register
|
||||
? ( <Register connect={this.hideRegisterForm} onRegister={this.onRegister} /> )
|
||||
? ( <Register connect={this.hideRegisterForm} /> )
|
||||
: ( <Connect register={this.showRegisterForm} /> )
|
||||
}
|
||||
</Paper>
|
||||
|
|
@ -106,7 +101,7 @@ const ServerRooms = ({ rooms, joinedRooms, history, message, users}) => (
|
|||
Users connected to server: {users.length}
|
||||
</div>
|
||||
<VirtualList
|
||||
itemKey={(index, data) => users[index].name }
|
||||
itemKey={(index) => users[index].name }
|
||||
items={ users.map(user => (
|
||||
<ListItem button dense>
|
||||
<UserDisplay user={user} />
|
||||
|
|
@ -122,13 +117,13 @@ const ServerRooms = ({ rooms, joinedRooms, history, message, users}) => (
|
|||
const Connect = ({register}) => (
|
||||
<div className="form-wrapper">
|
||||
<ConnectForm onSubmit={AuthenticationService.connect} />
|
||||
{/*{<Button variant="outlined" onClick={register}>Register</Button>}*/}
|
||||
<Button variant="outlined" onClick={register}>Register</Button>
|
||||
</div>
|
||||
);
|
||||
|
||||
const Register = ({ onRegister, connect }) => (
|
||||
const Register = ({ connect }) => (
|
||||
<div className="form-wrapper">
|
||||
<RegisterForm onSubmit={event => onRegister(event)} />
|
||||
<RegisterForm onSubmit={AuthenticationService.register} />
|
||||
<Button variant="outlined" onClick={connect}>Connect</Button>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue