Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 7b4815c

Browse files
committedApr 17, 2014
Added remember me column and methods
Per Laravel 4.1.26 release tightening application security, the users table require a remember me column and methods to set the remember me hash in the DB instead of in the cookie. Read more at http://laravel.com/docs/upgrade#upgrade-4.1.26
1 parent 62f2885 commit 7b4815c

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed
 

‎app/Tricks/User.php

+30
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,36 @@ public function votes()
6969
return $this->belongsToMany('Tricks\Trick', 'votes');
7070
}
7171

72+
/**
73+
* Get the remember me token from DB
74+
*
75+
* @return mixed
76+
*/
77+
public function getRememberToken()
78+
{
79+
return $this->remember_token;
80+
}
81+
82+
/**
83+
* Set the remember me token to DB
84+
*
85+
* @return mixed
86+
*/
87+
public function setRememberToken($value)
88+
{
89+
$this->remember_token = $value;
90+
}
91+
92+
/**
93+
* Get the column of remember me token in DB
94+
*
95+
* @return mixed
96+
*/
97+
public function getRememberTokenName()
98+
{
99+
return 'remember_token';
100+
}
101+
72102
/**
73103
* Get the unique identifier for the user.
74104
*
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
use Illuminate\Database\Schema\Blueprint;
4+
use Illuminate\Database\Migrations\Migration;
5+
6+
class AddRememberToUserTable extends Migration {
7+
8+
/**
9+
* Run the migrations.
10+
*
11+
* @return void
12+
*/
13+
public function up()
14+
{
15+
Schema::table('users', function($table)
16+
{
17+
$table->string('remember_token',100)->nullable()->after('id');
18+
});
19+
}
20+
21+
/**
22+
* Reverse the migrations.
23+
*
24+
* @return void
25+
*/
26+
public function down()
27+
{
28+
Schema::table('users', function($table)
29+
{
30+
$table->dropColumn('order');
31+
});
32+
}
33+
34+
}

2 commit comments

Comments
 (2)

Remo commented on Apr 17, 2014

@Remo
Contributor

thanks for this, I just started to work on it 👍

msurguy commented on Apr 17, 2014

@msurguy
MemberAuthor

You're welcome :)

Please sign in to comment.