mirror of
https://github.com/streetwriters/notesnook-sync-server.git
synced 2026-02-12 19:22:45 +00:00
identity: save which platform a user signed up from
this is normalized to web, android or iOS. Specific device information is not saved.
This commit is contained in:
1
ListMonk.SDK
Submodule
1
ListMonk.SDK
Submodule
Submodule ListMonk.SDK added at 4cb43f91bd
@@ -103,6 +103,7 @@ namespace Streetwriters.Identity.Controllers
|
||||
await UserManager.AddToRoleAsync(user, client.Id);
|
||||
if (Constants.IS_SELF_HOSTED)
|
||||
await UserManager.AddClaimAsync(user, UserService.SubscriptionTypeToClaim(client.Id, Common.Enums.SubscriptionType.PREMIUM));
|
||||
await UserManager.AddClaimAsync(user, new Claim("platform", PlatformFromUserAgent(base.HttpContext.Request.Headers.UserAgent)));
|
||||
|
||||
var code = await UserManager.GenerateEmailConfirmationTokenAsync(user);
|
||||
var callbackUrl = Url.TokenLink(user.Id.ToString(), code, client.Id, TokenType.CONFRIM_EMAIL, Request.Scheme);
|
||||
@@ -116,5 +117,10 @@ namespace Streetwriters.Identity.Controllers
|
||||
|
||||
return BadRequest(result.Errors.ToErrors());
|
||||
}
|
||||
|
||||
string PlatformFromUserAgent(string userAgent)
|
||||
{
|
||||
return userAgent.Contains("okhttp/") ? "android" : userAgent.Contains("Darwin/") || userAgent.Contains("CFNetwork/") ? "ios" : "web";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user