R2 accounts in decePub: forgotten password, email by code, sessions, the theme kept with the login
Completion program R2, with PrivaPub's routes of the same release.
- Pages/PasswordRecovery.razor (/password-recovery): asks for a login or an address and shows the server's one
sentence; with ?rc= it takes the code out of the address bar at once, checks it and sets a new password. Login links
there ("Forgot your password?").
- Settings, the login: its email address with a verified badge, changed with the password and the code emailed to it
(DOtp), removed with the password; "Sign out everywhere" (every device and persona, asked first).
- A password change takes the new JWT PrivaPub answers and exchanges the persona's token again, since every persona
token ended with it.
- The theme kept with the login (PageSettings.SyncWithLogin, Settings > General): taken at sign-in and start-up once a
client saved it, saved 1.5 s after a change here, never posted back when nothing changed, never the language.
- Login, Setup and Join start the session through CascadingState.SignedIn, which takes the login's theme.
- 38 keys in both resx files; CLAUDE.md follows.
Verified: dotnet build decePubClient.csproj -c Release (0 errors, no new warnings).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WpVCoDeM1qUTRp4fXQdfof
This commit is contained in:
1 parent
fd2f2e7c65
commit
7d4b35f0d7
15 files changed
+1056
-17
No files matched your search
@@ -19,6 +19,16 @@ public static class APIs
|
||||
public const string GET_Logout = "clientapi/user/logout";
|
||||
public const string GET_SniffAgain = "clientapi/user/sniff/again";
|
||||
public const string POST_UpdatePassword = "clientapi/user/update/password";
|
||||
public const string POST_LogoutEverywhere = "clientapi/user/logout/everywhere";
|
||||
public const string POST_RecoverPassword = "clientapi/user/recover/password";
|
||||
public const string POST_RecoverValid = "clientapi/user/recover/valid";
|
||||
public const string POST_RecoverUpdatePassword = "clientapi/user/recover/update/password";
|
||||
public const string GET_Account = "clientapi/user/account";
|
||||
public const string POST_Email = "clientapi/user/email";
|
||||
public const string POST_EmailVerify = "clientapi/user/email/verify";
|
||||
public const string POST_EmailRemove = "clientapi/user/email/remove";
|
||||
public const string GET_UserSettings = "clientapi/user/settings";
|
||||
public const string POST_UpdateUserSettings = "clientapi/user/update/settings";
|
||||
public const string POST_DeleteAccount = "clientapi/user/delete";
|
||||
public const string GET_Personas = "clientapi/avatar/private/list";
|
||||
public const string POST_InsertPersona = "clientapi/avatar/private/insert";
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
|
||||
using PrivaPub.ClientModels.Resources;
|
||||
using PrivaPub.ClientModels.User;
|
||||
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
@@ -21,6 +22,8 @@ namespace decePubClient.Models
|
||||
public bool ThemeIsDarkGray { get; set; } = false;
|
||||
// before publishing pictures without a description, the composer asks once
|
||||
public bool RemindAltText { get; set; } = true;
|
||||
// the theme is the login's (PrivaPub's user settings): taken at sign-in, saved there whenever it changes here
|
||||
public bool SyncWithLogin { get; set; } = true;
|
||||
|
||||
// How the theme flags combine is in wwwroot/js/theme.js: with PreferSystemTheming the OS picks light or dark;
|
||||
// otherwise ThemeIsDarkGray, then ThemeIsLightGray, then ThemeIsDarkMode decide; either grey flag drops the
|
||||
@@ -56,5 +59,33 @@ namespace decePubClient.Models
|
||||
LightThemeIndexColour = hue;
|
||||
SetGray(false, isDark);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// These settings as the login keeps them: the language as the two letters of the culture the app runs in
|
||||
/// (ExtensionMethods.ToCulture: "it" is it-IT, anything else en-GB), the icons' hue at its default, since the client
|
||||
/// has no such setting.
|
||||
/// </summary>
|
||||
public ViewUserSettings ToLoginSettings() => new()
|
||||
{
|
||||
LanguageCode = CurrentLanguageCode is "it" ? "it" : "en",
|
||||
LightThemeIndexColour = LightThemeIndexColour,
|
||||
DarkThemeIndexColour = DarkThemeIndexColour,
|
||||
IconsThemeIndexColour = DefaultLightThemeIndexColour,
|
||||
PreferSystemTheming = PreferSystemTheming,
|
||||
ThemeIsDarkMode = ThemeIsDarkMode,
|
||||
ThemeIsLightGray = ThemeIsLightGray,
|
||||
ThemeIsDarkGray = ThemeIsDarkGray
|
||||
};
|
||||
|
||||
/// <summary>Takes the login's theme; its language stays this device's, since changing it reloads the app.</summary>
|
||||
public void TakeLoginTheme(ViewUserSettings settings)
|
||||
{
|
||||
LightThemeIndexColour = Math.Clamp(settings.LightThemeIndexColour, (short)0, (short)359);
|
||||
DarkThemeIndexColour = Math.Clamp(settings.DarkThemeIndexColour, (short)0, (short)359);
|
||||
PreferSystemTheming = settings.PreferSystemTheming;
|
||||
ThemeIsDarkMode = settings.ThemeIsDarkMode;
|
||||
ThemeIsLightGray = settings.ThemeIsLightGray;
|
||||
ThemeIsDarkGray = settings.ThemeIsDarkGray;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user