summaryrefslogtreecommitdiff
path: root/public/assets/js/lib/views/profile/profile_edit.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2017-12-14 19:53:31 +0100
committerJules Laplace <julescarbon@gmail.com>2017-12-14 19:53:31 +0100
commit3a42fe7ad797a6f9cf747d2d358015ac992765a7 (patch)
tree169c2123067abc677b9e3fa8d19142bd3af3338e /public/assets/js/lib/views/profile/profile_edit.js
parentd776e6aa7d1e458ef050c016a4c285aa5887c5f0 (diff)
change password - profile stuff
Diffstat (limited to 'public/assets/js/lib/views/profile/profile_edit.js')
-rw-r--r--public/assets/js/lib/views/profile/profile_edit.js16
1 files changed, 15 insertions, 1 deletions
diff --git a/public/assets/js/lib/views/profile/profile_edit.js b/public/assets/js/lib/views/profile/profile_edit.js
index a887357..e50a7c0 100644
--- a/public/assets/js/lib/views/profile/profile_edit.js
+++ b/public/assets/js/lib/views/profile/profile_edit.js
@@ -64,6 +64,7 @@ var ProfileForm = FormView.extend({
canvas.height = h
ctx.drawImage(img, 0, 0, w, h)
var dataURI = canvas.toDataURL('image/jpeg', 0.85)
+ this.avatarBlob = dataUriToBlob(dataURI)
this.$("#profile-avatar-embed").show().attr("src", dataURI).css("width", w/2)
},
@@ -71,6 +72,18 @@ var ProfileForm = FormView.extend({
this.$(".oldpassword").css('display', 'flex')
},
+ serialize: function(){
+ var fd = this.__super__.serialize.call(this)
+ var oldpw = this.$("[name=oldpassword]").val()
+ var pw = this.$("[name=newpassword]").val()
+ var pw2 = this.$("[name=newpassword2]").val()
+ fd.delete('avatar')
+ if (this.avatarBlob) {
+ fd.append("avatar", this.avatarBlob)
+ }
+ return fd
+ },
+
validate: function(){
var errors = []
var oldpw = this.$("[name=oldpassword]").val()
@@ -89,6 +102,7 @@ var ProfileForm = FormView.extend({
if (data.error) {
return alert(data.error)
}
- window.location.href = "/details/" + data.id
+ auth.set_user(data.user)
+ window.location.href = "/profile"
}
}) \ No newline at end of file