psychobunny 12 years ago
commit 49fcea503e

@ -19,13 +19,13 @@
<div id="gravatar-box">
<img id="user-gravatar-picture" src="" class="img-polaroid user-profile-picture">
<span class="user-picture-label">Gravatar</span>
<i class='icon-ok'></i>
<i class='icon-ok icon-2x'></i>
</div>
<div id="uploaded-box">
<img id="user-uploaded-picture" src="" class="img-polaroid user-profile-picture">
<span class="user-picture-label">Uploaded picture</span>
<i class='icon-ok'></i>
<i class='icon-ok icon-2x'></i>
</div>
<a id="uploadPictureBtn" href="#">Upload new picture</a>
@ -50,6 +50,10 @@
<input id="userPhotoInput" type="file" name="userPhoto" >
</form>
<div id="upload-progress-box" class="progress progress-striped active hide">
<div id="upload-progress-bar" class="bar" style="width: 0%;"></div>
</div>
<div id="alert-status" class="alert hide"></div>
<div id="alert-success" class="alert alert-success hide"></div>
<div id="alert-error" class="alert alert-error hide"></div>
@ -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();
});
});

@ -23,8 +23,8 @@
</div>
<script>
// Alternate Logins
var altLoginEl = document.querySelector('.alt-logins');
altLoginEl.addEventListener('click', function(e) {
if (e.target.nodeName === 'LI') {
document.location.href = e.target.getAttribute('data-url');

@ -1,13 +1,21 @@
<!-- START Register Template -->
<h1>Register</h1>
<div class="well">
<form method="post" action="/register">
<label for="email">Email Address</label><input type="email" name="email" placeholder="Enter Email Address" id="email" /> <span id="email-notify" class="label label-important"></span> <br />
<label for="username">Username</label><input type="text" name="username" placeholder="Enter Username" id="username" /> <span id="username-notify" class="label label-success"></span> <br />
<label for="password">Password</label><input type="password" name="password" placeholder="Enter Password" id="password" /><br />
<button class="btn btn-primary" id="register" type="submit">Register Now</button>
</form>
<div class="row-fluid">
<div class="well {register_window:spansize}">
<form method="post" action="/register">
<label for="email">Email Address</label><input type="email" name="email" placeholder="Enter Email Address" id="email" /> <span id="email-notify" class="label label-important"></span> <br />
<label for="username">Username</label><input type="text" name="username" placeholder="Enter Username" id="username" /> <span id="username-notify" class="label label-success"></span> <br />
<label for="password">Password</label><input type="password" name="password" placeholder="Enter Password" id="password" /><br />
<button class="btn btn-primary" id="register" type="submit">Register Now</button>
</form>
</div>
<div class="well span6 {alternate_logins:display}">
<h4>Alternative Logins</h4>
<ul class="alt-logins">
<li data-url="/auth/twitter" class="twitter {twitter:display}"></li>
<li data-url="/auth/google" class="google {google:display}"></li>
<li data-url="/auth/facebook" class="facebook {facebook:display}"></li>
</ul>
</div>
</div>
<script type="text/javascript">
(function() {
@ -47,5 +55,13 @@
email_notify.innerHTML = '';
}
});
// Alternate Logins
var altLoginEl = document.querySelector('.alt-logins');
altLoginEl.addEventListener('click', function(e) {
if (e.target.nodeName === 'LI') {
document.location.href = e.target.getAttribute('data-url');
}
});
}());
</script>

@ -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<ii; i++) {
data[login_strategies[i] + ':display'] = 'active';
}
}
res.send(JSON.stringify(data));
break;
case 'topic' :
@ -205,9 +227,9 @@ var express = require('express'),
if(!req.user)
return res.redirect('/403');
if(req.files.userPhoto.size > 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'),
}
);
}

Loading…
Cancel
Save