Use cookies for dark mode

(also reverts most back-end changes from previous commit)
This commit is contained in:
2018-08-06 16:02:42 +02:00
parent 9fd6890667
commit a63e605a15
11 changed files with 98 additions and 11 deletions
@@ -38,7 +38,6 @@ class AccountController extends Controller
Rule::unique('users')->ignoreModel($user),
],
'new_password' => ['nullable', 'confirmed', VALI_PASSWORD],
'dark_mode' => 'nullable',
]);
if ($input->email != $user->email) {
+1 -2
View File
@@ -33,7 +33,6 @@ use MightyPork\Utils\Str;
* @property string $email - unique, for login and social auth chaining
* @property string $password - hashed pw
* @property bool $confirmed - user e-mail is confirmed
* @property bool $dark_mode - user prefers dark mode
* @property-read Proposal[]|Collection $proposals
* @property-read Table[]|Collection $tables
* @property-read OAuthIdentity[]|Collection $socialIdentities
@@ -63,7 +62,7 @@ class User extends BaseModel implements
* @var array
*/
protected $fillable = [
'name', 'title', 'email', 'password', 'bio', 'website', 'confirmed', 'dark_mode'
'name', 'title', 'email', 'password', 'bio', 'website', 'confirmed'
];
/**
+1 -1
View File
@@ -33,7 +33,7 @@ function faker() {
}
function dark_mode() {
return user() !== NULL && user()->dark_mode;
return isset($_COOKIE["dark_mode"]);
}
/**