Replace local user id with person id in JWT payload
This commit is contained in:
parent
6e7957f193
commit
9f2de50b1d
|
@ -11,7 +11,7 @@ part 'accounts_store.g.dart';
|
||||||
/// Store that manages all accounts
|
/// Store that manages all accounts
|
||||||
@JsonSerializable()
|
@JsonSerializable()
|
||||||
class AccountsStore extends ChangeNotifier {
|
class AccountsStore extends ChangeNotifier {
|
||||||
static const prefsKey = 'v2:AccountsStore';
|
static const prefsKey = 'v3:AccountsStore';
|
||||||
static final _prefs = SharedPreferences.getInstance();
|
static final _prefs = SharedPreferences.getInstance();
|
||||||
|
|
||||||
/// Map containing JWT tokens of specific users.
|
/// Map containing JWT tokens of specific users.
|
||||||
|
@ -206,7 +206,9 @@ class AccountsStore extends ChangeNotifier {
|
||||||
final userData =
|
final userData =
|
||||||
await lemmy.run(GetSite(auth: token.raw)).then((value) => value.myUser);
|
await lemmy.run(GetSite(auth: token.raw)).then((value) => value.myUser);
|
||||||
|
|
||||||
tokens[instanceHost][userData.person.name] = token;
|
tokens[instanceHost][userData.person.name] = token.copyWith(
|
||||||
|
payload: token.payload.copyWith(sub: userData.person.id),
|
||||||
|
);
|
||||||
|
|
||||||
await _assignDefaultAccounts();
|
await _assignDefaultAccounts();
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
|
|
@ -412,7 +412,7 @@ packages:
|
||||||
name: lemmy_api_client
|
name: lemmy_api_client
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.13.0"
|
version: "0.14.0"
|
||||||
logging:
|
logging:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -44,7 +44,7 @@ dependencies:
|
||||||
# utils
|
# utils
|
||||||
timeago: ^2.0.27
|
timeago: ^2.0.27
|
||||||
fuzzy: <1.0.0
|
fuzzy: <1.0.0
|
||||||
lemmy_api_client: ^0.13.0
|
lemmy_api_client: ^0.14.0
|
||||||
intl: ^0.17.0
|
intl: ^0.17.0
|
||||||
matrix4_transform: ^1.1.7
|
matrix4_transform: ^1.1.7
|
||||||
json_annotation: ^4.0.1
|
json_annotation: ^4.0.1
|
||||||
|
|
Loading…
Reference in New Issue