@@ -95,34 +95,18 @@ abstract class User implements UserInterface, GroupableInterface
9595 */
9696 protected $ groups ;
9797
98- /**
99- * @var bool
100- */
101- protected $ locked ;
102-
103- /**
104- * @var \DateTime
105- */
106- protected $ expiresAt ;
107-
10898 /**
10999 * @var array
110100 */
111101 protected $ roles ;
112102
113- /**
114- * @var \DateTime
115- */
116- protected $ credentialsExpireAt ;
117-
118103 /**
119104 * User constructor.
120105 */
121106 public function __construct ()
122107 {
123108 $ this ->salt = base_convert (sha1 (uniqid (mt_rand (), true )), 16 , 36 );
124109 $ this ->enabled = false ;
125- $ this ->locked = false ;
126110 $ this ->roles = array ();
127111 }
128112
@@ -153,11 +137,8 @@ public function serialize()
153137 $ this ->salt ,
154138 $ this ->usernameCanonical ,
155139 $ this ->username ,
156- $ this ->locked ,
157140 $ this ->enabled ,
158141 $ this ->id ,
159- $ this ->expiresAt ,
160- $ this ->credentialsExpireAt ,
161142 $ this ->email ,
162143 $ this ->emailCanonical ,
163144 ));
@@ -170,24 +151,23 @@ public function unserialize($serialized)
170151 {
171152 $ data = unserialize ($ serialized );
172153
173- if (9 === count ($ data )) {
174- unset($ data [4 ], $ data [6 ]);
175-
176- // add a few extra elements in the array to ensure that we have enough keys when unserializing
177- // older data which does not include all properties.
178- $ data = array_merge ($ data , array_fill (0 , 4 , null ));
154+ if (13 === count ($ data )) {
155+ // Unserializing a User object from 1.3.x
156+ unset($ data [4 ], $ data [5 ], $ data [6 ], $ data [9 ], $ data [10 ]);
157+ $ data = array_values ($ data );
158+ } elseif (11 === count ($ data )) {
159+ // Unserializing a User from a dev version somewhere between 2.0-alpha3 and 2.0-alpha4
160+ unset($ data [4 ], $ data [7 ], $ data [8 ]);
161+ $ data = array_values ($ data );
179162 }
180163
181164 list (
182165 $ this ->password ,
183166 $ this ->salt ,
184167 $ this ->usernameCanonical ,
185168 $ this ->username ,
186- $ this ->locked ,
187169 $ this ->enabled ,
188170 $ this ->id ,
189- $ this ->expiresAt ,
190- $ this ->credentialsExpireAt ,
191171 $ this ->email ,
192172 $ this ->emailCanonical
193173 ) = $ data ;
@@ -313,10 +293,6 @@ public function hasRole($role)
313293 */
314294 public function isAccountNonExpired ()
315295 {
316- if (null !== $ this ->expiresAt && $ this ->expiresAt ->getTimestamp () < time ()) {
317- return false ;
318- }
319-
320296 return true ;
321297 }
322298
@@ -325,18 +301,14 @@ public function isAccountNonExpired()
325301 */
326302 public function isAccountNonLocked ()
327303 {
328- return ! $ this -> locked ;
304+ return true ;
329305 }
330306
331307 /**
332308 * {@inheritdoc}
333309 */
334310 public function isCredentialsNonExpired ()
335311 {
336- if (null !== $ this ->credentialsExpireAt && $ this ->credentialsExpireAt ->getTimestamp () < time ()) {
337- return false ;
338- }
339-
340312 return true ;
341313 }
342314
@@ -345,11 +317,6 @@ public function isEnabled()
345317 return $ this ->enabled ;
346318 }
347319
348- public function isLocked ()
349- {
350- return !$ this ->isAccountNonLocked ();
351- }
352-
353320 /**
354321 * {@inheritdoc}
355322 */
@@ -391,18 +358,6 @@ public function setUsernameCanonical($usernameCanonical)
391358 return $ this ;
392359 }
393360
394- /**
395- * @param \DateTime $date
396- *
397- * @return User
398- */
399- public function setCredentialsExpireAt (\DateTime $ date = null )
400- {
401- $ this ->credentialsExpireAt = $ date ;
402-
403- return $ this ;
404- }
405-
406361 public function setEmail ($ email )
407362 {
408363 $ this ->email = $ email ;
@@ -430,18 +385,6 @@ public function setEnabled($boolean)
430385 return $ this ;
431386 }
432387
433- /**
434- * @param \DateTime $date
435- *
436- * @return User
437- */
438- public function setExpiresAt (\DateTime $ date = null )
439- {
440- $ this ->expiresAt = $ date ;
441-
442- return $ this ;
443- }
444-
445388 /**
446389 * {@inheritdoc}
447390 */
@@ -486,16 +429,6 @@ public function setLastLogin(\DateTime $time = null)
486429 return $ this ;
487430 }
488431
489- /**
490- * {@inheritdoc}
491- */
492- public function setLocked ($ boolean )
493- {
494- $ this ->locked = $ boolean ;
495-
496- return $ this ;
497- }
498-
499432 /**
500433 * {@inheritdoc}
501434 */
0 commit comments