diff options
author | Joram Wilander <jwawilander@gmail.com> | 2015-07-02 08:20:41 -0400 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2015-07-02 08:20:41 -0400 |
commit | bd9b038c0007eeb3c1d27cae17c25169a04052a8 (patch) | |
tree | 29ab0e74e8898a88478e6976e3b0a21a2c5e0286 /web/react | |
parent | 4adecf8198280a4712f81eb13e9bcd992df99c25 (diff) | |
parent | 855f3d3630576e0fe65751ef71a82eb0a1200f5e (diff) | |
download | chat-bd9b038c0007eeb3c1d27cae17c25169a04052a8.tar.gz chat-bd9b038c0007eeb3c1d27cae17c25169a04052a8.tar.bz2 chat-bd9b038c0007eeb3c1d27cae17c25169a04052a8.zip |
Merge pull request #118 from nickago/MM-1363
Mm 1363 Limit uploads to only JPEGs for profile pictures
Diffstat (limited to 'web/react')
-rw-r--r-- | web/react/components/user_settings.jsx | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/web/react/components/user_settings.jsx b/web/react/components/user_settings.jsx index 0a2a8125c..b4c3747af 100644 --- a/web/react/components/user_settings.jsx +++ b/web/react/components/user_settings.jsx @@ -809,6 +809,11 @@ var GeneralTab = React.createClass({ if(!this.submitActive) return; + if(this.state.picture.type !== "image/jpeg") { + this.setState({client_error: "Only JPG images may be used for profile pictures"}); + return; + } + formData = new FormData(); formData.append('image', this.state.picture, this.state.picture.name); @@ -839,11 +844,13 @@ var GeneralTab = React.createClass({ updatePicture: function(e) { if (e.target.files && e.target.files[0]) { this.setState({ picture: e.target.files[0] }); + + this.submitActive = true; + this.setState({client_error:null}) + } else { this.setState({ picture: null }); } - - this.submitActive = true }, updateSection: function(section) { this.setState({client_error:""}) @@ -984,7 +991,7 @@ var GeneralTab = React.createClass({ submit={this.submitPicture} src={"/api/v1/users/" + user.id + "/image"} server_error={server_error} - client_error={email_error} + client_error={client_error} updateSection={function(e){self.updateSection("");e.preventDefault();}} picture={this.state.picture} pictureChange={this.updatePicture} |