Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Memorekall Member New
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Rekall
Memorekall Member New
Commits
eef8cbcf
Commit
eef8cbcf
authored
3 years ago
by
Sebastien Curt
Browse files
Options
Downloads
Patches
Plain Diff
set User compatible to the production database
parent
e6acd9ac
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!8
Tuleap 40 register
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
migrations/Version20211122102457.php
+31
-0
31 additions, 0 deletions
migrations/Version20211122102457.php
src/Entity/User.php
+78
-7
78 additions, 7 deletions
src/Entity/User.php
with
109 additions
and
7 deletions
migrations/Version20211122102457.php
0 → 100644
+
31
−
0
View file @
eef8cbcf
<?php
declare
(
strict_types
=
1
);
namespace
DoctrineMigrations
;
use
Doctrine\DBAL\Schema\Schema
;
use
Doctrine\Migrations\AbstractMigration
;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final
class
Version20211122102457
extends
AbstractMigration
{
public
function
getDescription
():
string
{
return
''
;
}
public
function
up
(
Schema
$schema
):
void
{
// this up() migration is auto-generated, please modify it to your needs
$this
->
addSql
(
'ALTER TABLE user ADD $credential_expired TINYINT(1) NOT NULL, ADD enabled TINYINT(1) NOT NULL, ADD salt VARCHAR(255) NOT NULL'
);
}
public
function
down
(
Schema
$schema
):
void
{
// this down() migration is auto-generated, please modify it to your needs
$this
->
addSql
(
'ALTER TABLE `user` DROP $credential_expired, DROP enabled, DROP salt'
);
}
}
This diff is collapsed.
Click to expand it.
src/Entity/User.php
+
78
−
7
View file @
eef8cbcf
...
...
@@ -4,12 +4,14 @@ namespace App\Entity;
use
App\Repository\UserRepository
;
use
Doctrine\ORM\Mapping
as
ORM
;
use
Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity
;
use
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface
;
use
Symfony\Component\Security\Core\User\UserInterface
;
/**
* @ORM\Entity(repositoryClass=UserRepository::class)
* @ORM\Table(name="`user`")
* @UniqueEntity(fields={"email"}, message="There is already an account with this email")
*/
class
User
implements
UserInterface
,
PasswordAuthenticatedUserInterface
{
...
...
@@ -31,14 +33,14 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
private
$email_canonical
;
/**
* @ORM\Column(type="string")
* @ORM\Column(type="string"
, name="name"
)
*/
private
$
n
ame
;
private
$
lastN
ame
;
/**
* @ORM\Column(type="string")
* @ORM\Column(type="string"
, name="firstname"
)
*/
private
$first
n
ame
;
private
$first
N
ame
;
/**
* @ORM\Column(type="string")
...
...
@@ -50,6 +52,11 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
*/
private
$username_canonical
;
/**
* @ORM\Column(type="boolean", name="$credential_expired")
*/
private
$credentialExpired
=
false
;
/**
* @ORM\Column(type="json")
*/
...
...
@@ -61,6 +68,16 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
*/
private
$password
;
/**
* @ORM\Column(type="boolean", name="enabled")
*/
private
$isVerified
=
false
;
/**
* @ORM\Column(type="string", length=255, name="salt")
*/
private
$salt
;
public
function
getId
():
?int
{
return
$this
->
id
;
...
...
@@ -74,7 +91,9 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
public
function
setEmail
(
string
$email
):
self
{
$this
->
email
=
$email
;
$this
->
email_canonical
=
strtolower
(
$email
);
$this
->
username
=
$email
;
$this
->
username_canonical
=
strtolower
(
$email
);
return
$this
;
}
...
...
@@ -136,9 +155,9 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
*
* @see UserInterface
*/
public
function
getSalt
():
?
string
public
function
getSalt
():
string
{
return
null
;
return
$this
->
salt
;
}
/**
...
...
@@ -149,4 +168,56 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
// If you store any temporary, sensitive data on the user, clear it here
// $this->plainPassword = null;
}
public
function
isVerified
():
bool
{
return
$this
->
isVerified
;
}
public
function
setIsVerified
(
bool
$isVerified
):
self
{
$this
->
isVerified
=
$isVerified
;
return
$this
;
}
/**
* @return mixed
*/
public
function
getFirstName
()
:
string
{
return
$this
->
firstName
;
}
/**
* @return mixed
*/
public
function
getlastName
()
:
?string
{
return
$this
->
lastName
;
}
/**
* @param mixed $firstName
*/
public
function
setFirstName
(
string
$firstName
):
void
{
$this
->
firstName
=
$firstName
;
}
/**
* @param mixed $name
*/
public
function
setLastName
(
string
$name
):
void
{
$this
->
lastName
=
$name
;
}
/**
* @param mixed $salt
*/
public
function
setSalt
(
string
$salt
):
void
{
$this
->
salt
=
$salt
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment