|
|
@ -5,7 +5,7 @@ import "slick-carousel/slick/slick-theme.css"; |
|
|
|
import Slider from "react-slick"; |
|
|
|
import Slider from "react-slick"; |
|
|
|
import { Spin } from 'antd'; |
|
|
|
import { Spin } from 'antd'; |
|
|
|
import { Checkbox } from 'antd'; |
|
|
|
import { Checkbox } from 'antd'; |
|
|
|
import { LoadingOutlined } from '@ant-design/icons'; |
|
|
|
import { LoadingOutlined, EyeOutlined, EyeInvisibleOutlined } from '@ant-design/icons'; |
|
|
|
import { |
|
|
|
import { |
|
|
|
Button, |
|
|
|
Button, |
|
|
|
Card, |
|
|
|
Card, |
|
|
@ -64,11 +64,19 @@ class Login extends Component { |
|
|
|
validate: { |
|
|
|
validate: { |
|
|
|
emailState: '', |
|
|
|
emailState: '', |
|
|
|
}, |
|
|
|
}, |
|
|
|
loader: false |
|
|
|
loader: false, |
|
|
|
|
|
|
|
type: 'password' |
|
|
|
} |
|
|
|
} |
|
|
|
this.handleChange = this.handleChange.bind(this); |
|
|
|
this.handleChange = this.handleChange.bind(this); |
|
|
|
|
|
|
|
this.showHide = this.showHide.bind(this); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
showHide(e) { |
|
|
|
|
|
|
|
e.preventDefault(); |
|
|
|
|
|
|
|
e.stopPropagation(); |
|
|
|
|
|
|
|
this.setState({ |
|
|
|
|
|
|
|
type: this.state.type === 'input' ? 'password' : 'input' |
|
|
|
|
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
validateEmail(e) { |
|
|
|
validateEmail(e) { |
|
|
|
const emailRex = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; |
|
|
|
const emailRex = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; |
|
|
|
const { validate } = this.state |
|
|
|
const { validate } = this.state |
|
|
@ -163,7 +171,9 @@ class Login extends Component { |
|
|
|
window.localStorage.setItem('user_name', data_user.name); |
|
|
|
window.localStorage.setItem('user_name', data_user.name); |
|
|
|
window.localStorage.setItem('role_id', data_user.role_id); |
|
|
|
window.localStorage.setItem('role_id', data_user.role_id); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
NotificationManager.error('Cek username atau password anda!', 'Gagal Login!'); |
|
|
|
console.log("kode : ", doLogin.data.code); |
|
|
|
|
|
|
|
// NotificationManager.error('Cek username atau password anda!', 'Gagal Login!');
|
|
|
|
|
|
|
|
NotificationManager.error(doLogin.data.message, 'Login Failed!'); |
|
|
|
this.setState({ loader: false }); |
|
|
|
this.setState({ loader: false }); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -286,15 +296,23 @@ class Login extends Component { |
|
|
|
<i className="icon-lock"></i> |
|
|
|
<i className="icon-lock"></i> |
|
|
|
</InputGroupText> |
|
|
|
</InputGroupText> |
|
|
|
</InputGroupAddon> |
|
|
|
</InputGroupAddon> |
|
|
|
|
|
|
|
|
|
|
|
<Input |
|
|
|
<Input |
|
|
|
type="password" |
|
|
|
type={this.state.type} |
|
|
|
name="password" |
|
|
|
name="password" |
|
|
|
id="examplePassword" |
|
|
|
id="examplePassword" |
|
|
|
placeholder="********" |
|
|
|
placeholder="********" |
|
|
|
value={password} |
|
|
|
value={password} |
|
|
|
onChange={(e) => this.setState({ password: e.target.value })} |
|
|
|
onChange={(e) => this.setState({ password: e.target.value })} |
|
|
|
/> |
|
|
|
/> |
|
|
|
|
|
|
|
<InputGroupAddon addonType="prepend"> |
|
|
|
|
|
|
|
<InputGroupText |
|
|
|
|
|
|
|
onClick={this.showHide} |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
{this.state.type === 'input' ? <EyeOutlined /> : <EyeInvisibleOutlined />} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</InputGroupText> |
|
|
|
|
|
|
|
</InputGroupAddon> |
|
|
|
|
|
|
|
<span className="password__show" ></span> |
|
|
|
</InputGroup> |
|
|
|
</InputGroup> |
|
|
|
<Row> |
|
|
|
<Row> |
|
|
|
<Col xs="8"> |
|
|
|
<Col xs="8"> |
|
|
|