diff --git a/public/templates/accountedit.tpl b/public/templates/accountedit.tpl index 92bc621b3a..2b327d8eab 100644 --- a/public/templates/accountedit.tpl +++ b/public/templates/accountedit.tpl @@ -19,13 +19,13 @@
Gravatar - +
Uploaded picture - +
Upload new picture @@ -50,6 +50,10 @@ +
+
+
+
@@ -141,6 +145,9 @@ $(document).ready(function() { $('#uploadForm').submit(function() { status('uploading the file ...'); + $('#upload-progress-bar').css('width', '0%'); + $('#upload-progress-box').show(); + if(!$('#userPhotoInput').val()) { error('select an image to upload!'); return false; @@ -151,6 +158,11 @@ $(document).ready(function() { error: function(xhr) { error('Error: ' + xhr.status); }, + + uploadProgress : function(event, position, total, percent) { + $('#upload-progress-bar').css('width', percent+'%'); + }, + success: function(response) { if(response.error) { @@ -182,6 +194,7 @@ $(document).ready(function() { $('#alert-status').hide(); $('#alert-success').hide(); $('#alert-error').hide(); + $('#upload-progress-box').hide(); } function status(message) { @@ -198,25 +211,6 @@ $(document).ready(function() { hideAlerts(); $('#alert-error').text(message).show(); } - - - function submitUserData() { - var userData = { - uid:$('#inputUID').val(), - email:$('#inputEmail').val(), - fullname:$('#inputFullname').val(), - website:$('#inputWebsite').val(), - birthday:$('#inputBirthday').val(), - location:$('#inputLocation').val() - }; - - $.post('/edituser', - userData, - function(data) { - - } - ); - } function changeUserPicture(type) { var userData = { @@ -231,17 +225,28 @@ $(document).ready(function() { } ); } - var selectedImageType = ''; $('#submitBtn').on('click',function(){ - submitUserData(); + var userData = { + uid:$('#inputUID').val(), + email:$('#inputEmail').val(), + fullname:$('#inputFullname').val(), + website:$('#inputWebsite').val(), + birthday:$('#inputBirthday').val(), + location:$('#inputLocation').val() + }; + + $.post('/edituser', + userData, + function(data) { + } + ); }); - function updateImages() { var currentPicture = $('#user-current-picture').attr('src'); @@ -318,14 +323,15 @@ $(document).ready(function() { $('#change-picture-modal').modal('hide'); $('#upload-picture-modal').modal('show'); + hideAlerts(); - $('#pictureUploadSubmitBtn').on('click', function() { - $('#uploadForm').submit(); - }); - return false; }); + + $('#pictureUploadSubmitBtn').on('click', function() { + $('#uploadForm').submit(); + }); }); diff --git a/public/templates/login.tpl b/public/templates/login.tpl index ec2747c468..875e4760bd 100644 --- a/public/templates/login.tpl +++ b/public/templates/login.tpl @@ -23,8 +23,8 @@ \ No newline at end of file diff --git a/src/webserver.js b/src/webserver.js index 55e8387e02..a83f292d12 100644 --- a/src/webserver.js +++ b/src/webserver.js @@ -122,6 +122,28 @@ var express = require('express'), } } + res.send(JSON.stringify(data)); + break; + case 'register' : + var data = {}, + login_strategies = auth.get_login_strategies(), + num_strategies = login_strategies.length; + + if (num_strategies == 0) { + data = { + 'register_window:spansize': 'span12', + 'alternate_logins:display': 'none' + }; + } else { + data = { + 'register_window:spansize': 'span6', + 'alternate_logins:display': 'block' + } + for (var i=0, ii=num_strategies; i 65536) { + if(req.files.userPhoto.size > 131072) { res.send({ - error: 'Images must be smaller than 64kb!' + error: 'Images must be smaller than 128kb!' }); return; } @@ -243,8 +265,6 @@ var express = require('express'), filename = uid + '-' + filename var uploadPath = config.upload_path + filename; - - console.log(uploadPath); fs.rename( tempPath, @@ -252,7 +272,7 @@ var express = require('express'), function(error) { if(error) { res.send({ - error: 'Error uploading file! Error : '+ JSON.stringify(error) + error: 'Error uploading file!' }); return; } @@ -268,7 +288,6 @@ var express = require('express'), } ); - }