Fakultas Ilmu Komputer UI

Commit 61e21bdc authored by Izzatul Muttaqin's avatar Izzatul Muttaqin
Browse files

Merge branch '1606837915-147' into 'master'

Menghilangkan issue bug dan vulnerability pada EditProfile dan ProfilePage

See merge request !155
parents 5f8afa73 9571e3e3
Pipeline #25125 passed with stages
in 12 minutes and 29 seconds
......@@ -34,7 +34,6 @@ export default class ProfilePage extends React.Component {
gender: '',
region: '',
alamat: '',
alamat: '',
cityOfBirth: '',
dateOfBirth: '',
resume: '',
......@@ -55,7 +54,6 @@ export default class ProfilePage extends React.Component {
gender: '',
region: '',
alamat: '',
alamat: '',
skills: '',
resume: '',
portfolio_link: '',
......@@ -198,35 +196,34 @@ export default class ProfilePage extends React.Component {
alert(
'Pastikan link github yang anda tulis benar. (Berpola : https://github.com/<username>',
);
return;
}
const submitForm = {};
Object.keys(this.state.form).forEach((key) => {
if (this.state.form[key] !== '') {
submitForm[key] = this.state.form[key];
}
});
this.setState({ loading: true });
Server.submit(
`/students/${this.state.id}/profile/`,
submitForm,
'PATCH',
).then(
() => {
this.setState({ loading: false });
this.modalAlert.open(
'Profil berhasil diperbaharui',
'Silakan periksa kembali profil anda',
this.getProfile,
);
},
(error) =>
error.then((r) => {
} else {
var submitForm = {};
Object.keys(this.state.form).forEach((key) => {
if (this.state.form[key] !== '') {
submitForm[key] = this.state.form[key];
}
});
this.setState({ loading: true });
Server.submit(
`/students/${this.state.id}/profile/`,
submitForm,
'PATCH',
).then(
() => {
this.setState({ loading: false });
this.modalAlert.open('Pembaharuan profil gagal', Dumper.dump(r));
}),
);
this.modalAlert.open(
'Profil berhasil diperbaharui',
'Silakan periksa kembali profil anda',
this.getProfile,
);
},
(error) =>
error.then((r) => {
this.setState({ loading: false });
this.modalAlert.open('Pembaharuan profil gagal', Dumper.dump(r));
}),
);
}
};
handleFile = (e) => {
......
......@@ -200,35 +200,34 @@ export default class ProfilePage extends React.Component {
alert(
'Pastikan link github yang anda tulis benar. (Berpola : https://github.com/<username>',
);
return;
}
const submitForm = {};
Object.keys(this.state.form).forEach((key) => {
if (this.state.form[key] !== '') {
submitForm[key] = this.state.form[key];
}
});
this.setState({ loading: true });
Server.submit(
`/students/${this.state.id}/profile/`,
submitForm,
'PATCH',
).then(
() => {
this.setState({ loading: false });
this.modalAlert.open(
'Profil berhasil diperbaharui',
'Silakan periksa kembali profil anda',
this.getProfile,
);
},
(error) =>
error.then((r) => {
} else {
const submitForm = {};
Object.keys(this.state.form).forEach((key) => {
if (this.state.form[key] !== '') {
submitForm[key] = this.state.form[key];
}
});
this.setState({ loading: true });
Server.submit(
`/students/${this.state.id}/profile/`,
submitForm,
'PATCH',
).then(
() => {
this.setState({ loading: false });
this.modalAlert.open('Pembaharuan profil gagal', Dumper.dump(r));
}),
);
this.modalAlert.open(
'Profil berhasil diperbaharui',
'Silakan periksa kembali profil anda',
this.getProfile,
);
},
(error) =>
error.then((r) => {
this.setState({ loading: false });
this.modalAlert.open('Pembaharuan profil gagal', Dumper.dump(r));
}),
);
}
};
handleFile = (e) => {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment