1
0
mirror of https://github.com/exane/not-gwent-online synced 2024-11-27 03:46:54 +00:00

Merge remote-tracking branch 'origin/master'

This commit is contained in:
exane 2015-06-23 18:12:16 +02:00
commit 28aefb4417
3 changed files with 35 additions and 2 deletions

View File

@ -18,8 +18,23 @@ module.exports = {
if( ! this.username || ! this.password || ! this.email) { if( ! this.username || ! this.password || ! this.email) {
$('.form-error').hide().fadeIn('fast'); $('.form-error').hide().fadeIn('fast');
return false;
} }
$('.form-error').hide();
$('.icon-action-load').show();
this.$http.post('./api/register', this.$data, function(data) {
location.reload();
}).error(function (data) {
$('.icon-action-load').hide();
})
return false; return false;
} }
} }

View File

@ -1,5 +1,5 @@
.icon-load { .icon-action-load {
background: url(../img/load.gif) no-repeat; background: url(../img/action-load.gif) no-repeat;
width: 16px; width: 16px;
height: 16px; height: 16px;
float: right; float: right;

View File

@ -1,5 +1,23 @@
<?php <?php
// todo: move to controllers
use Gwent\User;
use Illuminate\Support\Facades\Request;
Route::group(['prefix' => 'api'], function() {
post('/register', function() {
$user = new User();
$user->username = Request::input('username');
$user->email = Request::input('email');
$user->password = bcrypt(Request::input('password'));
$user->save();
Auth::login($user);
});
});
get('/lobby', function() { get('/lobby', function() {
return innerView(); return innerView();
}); });