Registration Plugin is what you are looking for. :)
UPDATED
In Case you want to have custom form. You would have to take permission from user and get his details. You can use following Code :
<div id="fb-root"></div>
<script src="https://connect.facebook.net/en_US/all.js"></script>
FB.init({appId: 'XXXXXXXXXXXXX',status : true,xfbml : true, cookie: true ,oauth : true});
function login(){
FB.getLoginStatus(function(response) {
// checks if user already authorized
if (response.status === 'connected') {
FB.api('me?fields=id,name,email', function(user) {
if(user != null) {
username = user.name;
uid = user.id;
email = user.email;
}
});
} else {
// If user is not authorized call FB.login for pop up window for authorization , scope defines list of persmission requested with user
FB.login(function(response) {
if (response.authResponse.accessToken) {
FB.api('me?fields=id,name,email', function(user) {
if(user != null) {
username = user.name;
uid = user.id;
email = user.email;
}
})
}
}, {scope:'email'});
}
});
}
You call login() at the press of your button.