Render login form
This commit is contained in:
parent
cbf799d53f
commit
86e9c711a7
3 changed files with 40 additions and 0 deletions
31
app/gabsocial/features/auth_login/index.js
Normal file
31
app/gabsocial/features/auth_login/index.js
Normal file
|
@ -0,0 +1,31 @@
|
|||
import React from 'react';
|
||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||
|
||||
export default class LoginForm extends ImmutablePureComponent {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.handleSubmit = this.handleSubmit.bind(this);
|
||||
}
|
||||
|
||||
getFormData(form) {
|
||||
return Object.fromEntries(
|
||||
Array.from(form).map(i => [i.name, i.value])
|
||||
);
|
||||
}
|
||||
|
||||
handleSubmit(event) {
|
||||
const {username, password} = this.getFormData(event.target);
|
||||
console.log(username + ' ' + password);
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<form onSubmit={this.handleSubmit}>
|
||||
<input name='username' placeholder='me@example.com' />
|
||||
<input name='password' type='password' placeholder='Password' />
|
||||
<input type='submit' value='Login' />
|
||||
</form>
|
||||
)
|
||||
}
|
||||
}
|
|
@ -64,6 +64,7 @@ import {
|
|||
GroupRemovedAccounts,
|
||||
GroupCreate,
|
||||
GroupEdit,
|
||||
LoginForm,
|
||||
} from './util/async-components';
|
||||
import { meUsername } from '../../initial_state';
|
||||
import { previewState as previewMediaState } from './components/media_modal';
|
||||
|
@ -186,6 +187,10 @@ class SwitchingColumnsArea extends React.PureComponent {
|
|||
return (
|
||||
<Switch>
|
||||
<Redirect from='/' to='/home' exact />
|
||||
{/* <WrappedRoute path='/' component={} publicRoute exact /> */}
|
||||
<WrappedRoute path='/auth/sign_in' component={LoginForm} publicRoute exact />
|
||||
{/* <WrappedRoute path='/auth/sign_out' component={LogoutForm} publicRoute exact /> */}
|
||||
|
||||
<WrappedRoute path='/home' exact page={HomePage} component={HomeTimeline} content={children} />
|
||||
<WrappedRoute path='/timeline/local' exact page={HomePage} component={CommunityTimeline} content={children} />
|
||||
<WrappedRoute path='/timeline/fediverse' exact page={HomePage} component={PublicTimeline} content={children} />
|
||||
|
|
|
@ -157,3 +157,7 @@ export function Search () {
|
|||
export function Explore () {
|
||||
return import(/* webpackChunkName: "features/explore" */'../../explore');
|
||||
}
|
||||
|
||||
export function LoginForm () {
|
||||
return import(/* webpackChunkName: "features/auth_login" */'../../auth_login');
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue