@@ -219,7 +222,9 @@ else
@code {
private string username = string.Empty;
- private string password = string.Empty;
+ private string _password = string.Empty;
+ private string _passwordtype = "password";
+ private string _togglepassword = string.Empty;
private string confirm = string.Empty;
private bool allowtwofactor = false;
private string twofactor = "False";
@@ -241,6 +246,7 @@ else
{
try
{
+ _togglepassword = Localizer["ShowPassword"];
if (PageState.Site.Settings.ContainsKey("LoginOptions:TwoFactor") && !string.IsNullOrEmpty(PageState.Site.Settings["LoginOptions:TwoFactor"]))
{
allowtwofactor = bool.Parse(PageState.Site.Settings["LoginOptions:TwoFactor"]);
@@ -303,11 +309,11 @@ else
{
if (username != string.Empty && email != string.Empty && ValidateProfiles())
{
- if (password == confirm)
+ if (_password == confirm)
{
var user = PageState.User;
user.Username = username;
- user.Password = password;
+ user.Password = _password;
user.TwoFactorRequired = bool.Parse(twofactor);
user.Email = email;
user.DisplayName = (displayname == string.Empty ? username : displayname);
@@ -444,4 +450,18 @@ else
}
+ private void TogglePassword()
+ {
+ if (_passwordtype == "password")
+ {
+ _passwordtype = "text";
+ _togglepassword = Localizer["HidePassword"];
+ }
+ else
+ {
+ _passwordtype = "password";
+ _togglepassword = Localizer["ShowPassword"];
+ }
+ }
+
}
diff --git a/Oqtane.Client/Modules/Admin/Users/Add.razor b/Oqtane.Client/Modules/Admin/Users/Add.razor
index 4cde0a47..5fc0d465 100644
--- a/Oqtane.Client/Modules/Admin/Users/Add.razor
+++ b/Oqtane.Client/Modules/Admin/Users/Add.razor
@@ -20,8 +20,11 @@
-
@@ -88,7 +91,9 @@
@code {
private string username = string.Empty;
- private string password = string.Empty;
+ private string _password = string.Empty;
+ private string _passwordtype = "password";
+ private string _togglepassword = string.Empty;
private string confirm = string.Empty;
private string email = string.Empty;
private string displayname = string.Empty;
@@ -102,6 +107,7 @@
{
try
{
+ _togglepassword = Localizer["ShowPassword"];
profiles = await ProfileService.GetProfilesAsync(ModuleState.SiteId);
settings = new Dictionary();
}
@@ -119,9 +125,9 @@
{
try
{
- if (username != string.Empty && password != string.Empty && confirm != string.Empty && email != string.Empty && ValidateProfiles())
+ if (username != string.Empty && _password != string.Empty && confirm != string.Empty && email != string.Empty && ValidateProfiles())
{
- if (password == confirm)
+ if (_password == confirm)
{
var user = await UserService.GetUserAsync(username, PageState.Site.SiteId);
if (user == null)
@@ -129,7 +135,7 @@
user = new User();
user.SiteId = PageState.Site.SiteId;
user.Username = username;
- user.Password = password;
+ user.Password = _password;
user.Email = email;
user.DisplayName = string.IsNullOrWhiteSpace(displayname) ? username : displayname;
user.PhotoFileId = null;
@@ -193,4 +199,17 @@
settings = SettingService.SetSetting(settings, SettingName, value);
}
+ private void TogglePassword()
+ {
+ if (_passwordtype == "password")
+ {
+ _passwordtype = "text";
+ _togglepassword = Localizer["HidePassword"];
+ }
+ else
+ {
+ _passwordtype = "password";
+ _togglepassword = Localizer["ShowPassword"];
+ }
+ }
}
diff --git a/Oqtane.Client/Modules/Admin/Users/Edit.razor b/Oqtane.Client/Modules/Admin/Users/Edit.razor
index 167adc8d..b2445c4c 100644
--- a/Oqtane.Client/Modules/Admin/Users/Edit.razor
+++ b/Oqtane.Client/Modules/Admin/Users/Edit.razor
@@ -29,8 +29,11 @@ else
-
@@ -133,7 +136,9 @@ else
@code {
private int userid;
private string username = string.Empty;
- private string password = string.Empty;
+ private string _password = string.Empty;
+ private string _passwordtype = "password";
+ private string _togglepassword = string.Empty;
private string confirm = string.Empty;
private string email = string.Empty;
private string displayname = string.Empty;
@@ -160,6 +165,7 @@ else
// OnParametersSetAsync is called when the edit modal is closed - in which case there is no id parameter
if (PageState.QueryString.ContainsKey("id"))
{
+ _togglepassword = Localizer["ShowPassword"];
profiles = await ProfileService.GetProfilesAsync(PageState.Site.SiteId);
userid = Int32.Parse(PageState.QueryString["id"]);
var user = await UserService.GetUserAsync(userid, PageState.Site.SiteId);
@@ -205,12 +211,12 @@ else
{
if (username != string.Empty && email != string.Empty && ValidateProfiles())
{
- if (password == confirm)
+ if (_password == confirm)
{
var user = await UserService.GetUserAsync(userid, PageState.Site.SiteId);
user.SiteId = PageState.Site.SiteId;
user.Username = username;
- user.Password = password;
+ user.Password = _password;
user.Email = email;
user.DisplayName = string.IsNullOrWhiteSpace(displayname) ? username : displayname;
user.PhotoFileId = null;
@@ -268,4 +274,17 @@ else
settings = SettingService.SetSetting(settings, SettingName, value);
}
+ private void TogglePassword()
+ {
+ if (_passwordtype == "password")
+ {
+ _passwordtype = "text";
+ _togglepassword = Localizer["HidePassword"];
+ }
+ else
+ {
+ _passwordtype = "password";
+ _togglepassword = Localizer["ShowPassword"];
+ }
+ }
}
diff --git a/Oqtane.Client/Resources/Modules/Admin/UserProfile/Index.resx b/Oqtane.Client/Resources/Modules/Admin/UserProfile/Index.resx
index 6eabb548..eccd3c38 100644
--- a/Oqtane.Client/Resources/Modules/Admin/UserProfile/Index.resx
+++ b/Oqtane.Client/Resources/Modules/Admin/UserProfile/Index.resx
@@ -219,4 +219,10 @@
Delete ALL Notifications
+
+ Hide
+
+
+ Show
+
\ No newline at end of file
diff --git a/Oqtane.Client/Resources/Modules/Admin/Users/Add.resx b/Oqtane.Client/Resources/Modules/Admin/Users/Add.resx
index 4726a6e9..37bf3f31 100644
--- a/Oqtane.Client/Resources/Modules/Admin/Users/Add.resx
+++ b/Oqtane.Client/Resources/Modules/Admin/Users/Add.resx
@@ -168,4 +168,13 @@
Username:
+
+ Hide
+
+
+ Show
+
+
+ Password
+
\ No newline at end of file
diff --git a/Oqtane.Client/Resources/Modules/Admin/Users/Edit.resx b/Oqtane.Client/Resources/Modules/Admin/Users/Edit.resx
index 86f18fb8..7fabae46 100644
--- a/Oqtane.Client/Resources/Modules/Admin/Users/Edit.resx
+++ b/Oqtane.Client/Resources/Modules/Admin/Users/Edit.resx
@@ -183,4 +183,13 @@
Profile
+
+ Hide
+
+
+ Show
+
+
+ Password
+
\ No newline at end of file