Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Platform
Commits
dab7089d
Commit
dab7089d
authored
May 06, 2018
by
Mariusz Fik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix creation of an activated user.
Signed-off-by:
Mariusz Fik
<
mariusz@fidano.pl
>
parent
5ae06f6d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
2 deletions
+56
-2
UserForm.vue
Modules/User/Assets/js/components/UserForm.vue
+2
-1
ApiUserControllerTest.php
Modules/User/Tests/ApiUserControllerTest.php
+53
-0
FullUserTransformer.php
Modules/User/Transformers/FullUserTransformer.php
+1
-1
No files found.
Modules/User/Assets/js/components/UserForm.vue
View file @
dab7089d
...
@@ -51,7 +51,7 @@
...
@@ -51,7 +51,7 @@
<
/el-form-item
>
<
/el-form-item
>
<
el
-
form
-
item
:
label
=
"
trans('users.form.is activated')
"
<
el
-
form
-
item
:
label
=
"
trans('users.form.is activated')
"
:
class
=
"
{'el-form-item is-error': form.errors.has('activated')
}
"
>
:
class
=
"
{'el-form-item is-error': form.errors.has('activated')
}
"
>
<
el
-
checkbox
v
-
model
=
"
user.activated
"
>
Activated
<
/el-checkbox
>
<
el
-
checkbox
v
-
model
=
"
user.
is_
activated
"
>
Activated
<
/el-checkbox
>
<
div
class
=
"
el-form-item__error
"
v
-
if
=
"
form.errors.has('activated')
"
<
div
class
=
"
el-form-item__error
"
v
-
if
=
"
form.errors.has('activated')
"
v
-
text
=
"
form.errors.first('activated')
"
><
/div
>
v
-
text
=
"
form.errors.first('activated')
"
><
/div
>
<
/el-form-item
>
<
/el-form-item
>
...
@@ -161,6 +161,7 @@
...
@@ -161,6 +161,7 @@
permissions
:
{
}
,
permissions
:
{
}
,
roles
:
{
}
,
roles
:
{
}
,
is_new
:
false
,
is_new
:
false
,
is_activated
:
false
,
}
,
}
,
roles
:
{
}
,
roles
:
{
}
,
form
:
new
Form
(),
form
:
new
Form
(),
...
...
Modules/User/Tests/ApiUserControllerTest.php
0 → 100644
View file @
dab7089d
<?php
namespace
Modules\User\Tests
;
use
Modules\User\Entities\Sentinel\User
;
use
Modules\User\Http\Controllers\Api\UserController
;
use
Modules\User\Http\Requests\CreateUserRequest
;
use
Modules\User\Permissions\PermissionManager
;
use
Modules\User\Repositories\UserRepository
;
use
Modules\User\Repositories\UserTokenRepository
;
class
ApiUserControllerTest
extends
BaseUserTestCase
{
/**
* @var UserRepository
*/
private
$user
;
/**
* @var PermissionManager
*/
private
$permissions
;
/**
* @var UserTokenRepository
*/
private
$userToken
;
public
function
setUp
()
{
parent
::
setUp
();
$this
->
user
=
app
(
UserRepository
::
class
);
$this
->
permissions
=
app
(
PermissionManager
::
class
);
$this
->
userToken
=
app
(
UserTokenRepository
::
class
);
}
/** @test */
public
function
it_creates_a_new_activated_user
()
{
$data
=
[
'email'
=>
'user@domain.tld'
,
'password'
=>
'Pa$$w0rd'
,
'is_activated'
=>
true
,
];
$request
=
CreateUserRequest
::
create
(
''
,
''
,
$data
);
$controller
=
new
UserController
(
$this
->
user
,
$this
->
permissions
,
$this
->
userToken
);
$controller
->
store
(
$request
);
$user
=
$this
->
user
->
find
(
1
);
$this
->
assertInstanceOf
(
User
::
class
,
$user
);
$this
->
assertTrue
(
$user
->
isActivated
());
}
}
Modules/User/Transformers/FullUserTransformer.php
View file @
dab7089d
...
@@ -17,7 +17,7 @@ class FullUserTransformer extends Resource
...
@@ -17,7 +17,7 @@ class FullUserTransformer extends Resource
'first_name'
=>
$this
->
first_name
,
'first_name'
=>
$this
->
first_name
,
'last_name'
=>
$this
->
last_name
,
'last_name'
=>
$this
->
last_name
,
'email'
=>
$this
->
email
,
'email'
=>
$this
->
email
,
'activated'
=>
$this
->
isActivated
(),
'
is_
activated'
=>
$this
->
isActivated
(),
'last_login'
=>
$this
->
last_login
,
'last_login'
=>
$this
->
last_login
,
'created_at'
=>
$this
->
created_at
,
'created_at'
=>
$this
->
created_at
,
'permissions'
=>
$permissions
,
'permissions'
=>
$permissions
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment