#15435 - Saving user version on singup
This commit is contained in:
parent
b3644c8735
commit
37f0f717d4
@ -30,6 +30,27 @@ class User extends BaseCustomer implements WsseUser
|
||||
return $model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save customer version in DB
|
||||
*
|
||||
* @param string $version
|
||||
*
|
||||
* @return boolean Whether operation succeed
|
||||
*/
|
||||
public function saveVersion($version = null) {
|
||||
if ($version === null) {
|
||||
$version = config('api.defaultVersion');
|
||||
}
|
||||
return \Db::getInstance()->ExecuteS('
|
||||
INSERT INTO `'._DB_PREFIX_.'customer_version`
|
||||
VALUES (
|
||||
'.(int) $this->id.',
|
||||
"'.pSQL(!isset($version) ? 'fr': $version).'",
|
||||
NOW()
|
||||
)
|
||||
');
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Antadis\Auth\Wsse\Contracts\WsseUser::getWssePassword()
|
||||
*/
|
||||
|
@ -7,6 +7,7 @@ use Antadis\API\Front\Web\Controllers\AuthController as BaseAuthController;
|
||||
use Antadis\API\Front\Exceptions\HttpBadRequestException;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
use ApiValidate;
|
||||
use ApiCart;
|
||||
|
||||
class AuthController extends BaseAuthController
|
||||
@ -45,10 +46,17 @@ class AuthController extends BaseAuthController
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @Override #15435 - Saving user version
|
||||
*/
|
||||
public function signup(Request $request)
|
||||
{
|
||||
$user = parent::signup($request);
|
||||
|
||||
if (ApiValidate::isLoadedObject($user)) {
|
||||
$user->saveVersion();
|
||||
}
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
|
@ -18,4 +18,5 @@ return array(
|
||||
],
|
||||
],
|
||||
'id_cms_ant_support' => array(14),
|
||||
'defaultVersion' => 'fr',
|
||||
);
|
@ -18,4 +18,5 @@ return array(
|
||||
],
|
||||
],
|
||||
'id_cms_ant_support' => array(14),
|
||||
'defaultVersion' => 'fr',
|
||||
);
|
@ -18,4 +18,5 @@ return array(
|
||||
],
|
||||
],
|
||||
'id_cms_ant_support' => array(14),
|
||||
'defaultVersion' => 'fr',
|
||||
);
|
Loading…
Reference in New Issue
Block a user