@@ -7,7 +7,6 @@ |
||
| 7 | 7 | use Symfony\Component\HttpFoundation\JsonResponse; |
| 8 | 8 | use Silex\Application; |
| 9 | 9 | use Silex\Api\ControllerProviderInterface; |
| 10 | -use Monolog\Logger; |
|
| 11 | 10 | use RedBeanPHP\Facade as R; |
| 12 | 11 | |
| 13 | 12 | class SecurityController implements ControllerProviderInterface |
@@ -54,15 +54,14 @@ discard block |
||
| 54 | 54 | "clientId"=>$user->id |
| 55 | 55 | ]; |
| 56 | 56 | $response = JsonResponse::create($res, 200, $headers)->setSharedMaxAge(300); |
| 57 | - }else{ |
|
| 57 | + } else{ |
|
| 58 | 58 | $headers=[]; |
| 59 | 59 | $res = [ |
| 60 | 60 | "errore"=>"sbagliato password o user" //TODO roba |
| 61 | 61 | ]; |
| 62 | 62 | $response = JsonResponse::create($res, 401, $headers)->setSharedMaxAge(300); |
| 63 | 63 | } |
| 64 | - } |
|
| 65 | - else{ |
|
| 64 | + } else{ |
|
| 66 | 65 | //Facebook Redirect |
| 67 | 66 | } |
| 68 | 67 | return $response;// JsonResponse::create($output, 200, $headers)->setSharedMaxAge(300); |
@@ -83,14 +82,14 @@ discard block |
||
| 83 | 82 | if (!$bean->id){ |
| 84 | 83 | //TODO mettere un controllo agli IP che forzano le richieste di token falsi |
| 85 | 84 | $response = "<html><head></head><body>Token non esistente!</body></html>"; |
| 86 | - }else{ |
|
| 85 | + } else{ |
|
| 87 | 86 | if(strtotime($verify->inserttime) < strtotime("-15 minutes")){ |
| 88 | 87 | $user = R::load('user',$verify->user); |
| 89 | 88 | $user->status="enabled"; |
| 90 | 89 | $user->updatetime=date('Y-m-d H:i:s'); |
| 91 | 90 | $id = R::store($user); |
| 92 | 91 | $response = "<html><head></head><body>Account attivato complimenti!</body></html>"; |
| 93 | - }else{ |
|
| 92 | + } else{ |
|
| 94 | 93 | $response = "<html><head></head><body>Impossibile attivare account inserire mail e password per richiedere un nuovo token!</body></html>"; |
| 95 | 94 | } |
| 96 | 95 | } |
@@ -3,11 +3,9 @@ |
||
| 3 | 3 | namespace BitPrepared\Bundle\D1b0Workspace\Controller\V1; |
| 4 | 4 | |
| 5 | 5 | use Symfony\Component\HttpFoundation\Request; |
| 6 | -use Symfony\Component\HttpFoundation\Response; |
|
| 7 | 6 | use Symfony\Component\HttpFoundation\JsonResponse; |
| 8 | 7 | use Silex\Application; |
| 9 | 8 | use Silex\Api\ControllerProviderInterface; |
| 10 | -use Monolog\Logger; |
|
| 11 | 9 | use RedBeanPHP\Facade as R; |
| 12 | 10 | |
| 13 | 11 | class WorkspaceController implements ControllerProviderInterface |
@@ -11,13 +11,11 @@ |
||
| 11 | 11 | use Silex\Application; |
| 12 | 12 | use Symfony\Component\HttpFoundation\Request; |
| 13 | 13 | use Symfony\Component\HttpFoundation\Response; |
| 14 | -use Symfony\Component\HttpFoundation\JsonResponse; |
|
| 15 | 14 | use Silex\Provider\MonologServiceProvider; |
| 16 | 15 | use Ivoba\Silex\RedBeanServiceProvider; |
| 17 | 16 | use Silex\Provider\SessionServiceProvider; |
| 18 | 17 | use Carbon\Carbon; |
| 19 | 18 | use Monolog\Logger; |
| 20 | -use RedBeanPHP\Facade as R; |
|
| 21 | 19 | |
| 22 | 20 | // FIXME va messo nel php.ini |
| 23 | 21 | date_default_timezone_set('Europe/Rome'); |
@@ -106,11 +106,11 @@ |
||
| 106 | 106 | $user->updatetime=date('Y-m-d G:i:s'); |
| 107 | 107 | $id = R::store($user); |
| 108 | 108 | $res = (object)["id" => $id]; |
| 109 | - }catch(Exception $e){ |
|
| 109 | + } catch(Exception $e){ |
|
| 110 | 110 | echo $e; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - }else{ |
|
| 113 | + } else{ |
|
| 114 | 114 | |
| 115 | 115 | } |
| 116 | 116 | |