Guillermo - add-edit-password-frontend [skip ci]

This commit is contained in:
AntonyAntonio 2016-09-16 19:53:41 -03:00
parent e85f38fbde
commit 3bd5db9bf0
3 changed files with 51 additions and 9 deletions

View File

@ -9,26 +9,35 @@ import SubmitButton from 'core-components/submit-button';
class DashboardEditProfilePage extends React.Component {
state = {
loading: false
state= {
loadingEmail: false,
loadingPass: false
};
render() {
return (
<div className="edit-profile-page">
<Header title="Edit Profile" description="adsfasdfasdfasdfasdf asdfa" />
<Header title="Edit Profile" description="what ever" />
<div className="edit-profile-page__title">Edit Email</div>
<Form loading={this.state.loading} onSubmit={this.onSubmit.bind(this)}>
<FormField name="newEmail" label="New Email" field="input" validation="EMAIL" required/>
<Form loading={this.state.loadingEmail} onSubmit={this.onSubmitEditEmail.bind(this)}>
<FormField name="newEmail" label="New Email" field="input" validation="EMAIL" fieldProps={{size:'large'}} required/>
<SubmitButton>CHANGE EMAIL</SubmitButton>
</Form>
<div className="edit-profile-page__title">Edit password</div>
<Form loading={this.state.loadingPass} onSubmit={this.onSubmitEditPassword.bind(this)}>
<FormField name="oldPassword" label="Old Password" field="input" validation="PASSWORD" fieldProps={{password:true ,size:'large'}} required/>
<FormField name="password" label="New Password" field="input" validation="PASSWORD" fieldProps={{password:true ,size:'large'}} required/>
<FormField name="repeatNewPassword" label="Repeat New Password" field="input" validation="REPEAT_PASSWORD" fieldProps={{password:true ,size:'large'}} required/>
<SubmitButton>CHANGE PASSWORD</SubmitButton>
</Form>
</div>
);
}
onSubmit(formState) {
onSubmitEditEmail(formState) {
this.setState({
loading: true
loadingEmail: true
});
API.call({
@ -38,7 +47,25 @@ class DashboardEditProfilePage extends React.Component {
}
}).then(function () {
this.setState({
loading: false
loadingEmail: false
});
}.bind(this));
}
onSubmitEditPassword(formState) {
this.setState({
loadingPass: true
});
API.call({
path: "/user/edit-password",
data: {
oldPassword: formState.oldPassword,
newPassword: formState.password
}
}).then(function () {
this.setState({
loadingPass: false
});
}.bind(this));
}

View File

@ -6,6 +6,7 @@ import i18n from 'lib-app/i18n';
import Header from 'core-components/header';
import Table from 'core-components/table';
import Button from 'core-components/button';
import Tooltip from 'core-components/tooltip';
class DashboardListTicketsPage extends React.Component {
static propTypes = {
@ -58,7 +59,11 @@ class DashboardListTicketsPage extends React.Component {
let titleText = (ticket.unread) ? ticket.title + ' (1)' : ticket.title;
return {
number: '#' + ticket.ticketNumber,
number: (
<Tooltip content="hola">
{'#' + ticket.ticketNumber}
</Tooltip>
),
title: (
<Button className="dashboard-ticket-list__title-link" type="clean" route={{to: '/dashboard/ticket/' + ticket.ticketNumber}}>
{titleText}

View File

@ -114,6 +114,16 @@ module.exports = [
};
}
},
{
path: '/user/edit-password',
time: 1000,
response: function () {
return {
status: 'success',
data: {}
};
}
},
{
path: '/user/get',
time: 100,