aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/FSE/Modules
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2024-05-05 17:24:14 +0300
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2024-05-05 17:24:14 +0300
commit2e752ce186fc34f5530841bdac7537ee775ed3f6 (patch)
treeab4fad972fac8f8fc530b233f567ef33453f36a9 /Software/Visual_Studio/FSE/Modules
parent5ebb5e6092a74190654bf6d9e5d7d46f9db775a6 (diff)
downloadTango-2e752ce186fc34f5530841bdac7537ee775ed3f6.tar.gz
Tango-2e752ce186fc34f5530841bdac7537ee775ed3f6.zip
Job uploader from FSE/RSM.
User password reset from FSE. Connectivity check method set to Windows by default.
Diffstat (limited to 'Software/Visual_Studio/FSE/Modules')
-rw-r--r--Software/Visual_Studio/FSE/Modules/Tango.FSE.UsersAndRoles/ViewModels/UserDetailsViewVM.cs35
-rw-r--r--Software/Visual_Studio/FSE/Modules/Tango.FSE.UsersAndRoles/Views/UserDetailsView.xaml10
2 files changed, 43 insertions, 2 deletions
diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.UsersAndRoles/ViewModels/UserDetailsViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.UsersAndRoles/ViewModels/UserDetailsViewVM.cs
index 9f021ddb1..701e67aa8 100644
--- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.UsersAndRoles/ViewModels/UserDetailsViewVM.cs
+++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.UsersAndRoles/ViewModels/UserDetailsViewVM.cs
@@ -36,6 +36,20 @@ namespace Tango.FSE.UsersAndRoles.ViewModels
set { _organization = value; RaisePropertyChangedAuto(); }
}
+ private bool _isResetUserPassword;
+ public bool IsResetUserPassword
+ {
+ get { return _isResetUserPassword; }
+ set { _isResetUserPassword = value; RaisePropertyChangedAuto(); }
+ }
+
+ private String _resetPassword;
+ public String ResetPassword
+ {
+ get { return _resetPassword; }
+ set { _resetPassword = value; RaisePropertyChangedAuto(); }
+ }
+
private bool _isNewUser;
public bool IsNewUser
{
@@ -121,11 +135,26 @@ namespace Tango.FSE.UsersAndRoles.ViewModels
public RelayCommand GeneratePasswordCommand { get; set; }
+ public RelayCommand ResetPasswordCommand { get; set; }
+
+ public RelayCommand GenerateResetPasswordCommand { get; set; }
+
public UserDetailsViewVM()
{
SaveCommand = new RelayCommand(Save, () => IsFree);
GeneratePasswordCommand = new RelayCommand(GeneratePassword);
SendInvitation = true;
+
+ ResetPasswordCommand = new RelayCommand(() => { IsResetUserPassword = true; GenerateResetPassword(); });
+ GenerateResetPasswordCommand = new RelayCommand(GenerateResetPassword);
+ }
+
+ private void GenerateResetPassword()
+ {
+ if (IsResetUserPassword)
+ {
+ ResetPassword = Services.OrganizationsService.GenerateRandomPassword();
+ }
}
private void GeneratePassword()
@@ -190,7 +219,7 @@ namespace Tango.FSE.UsersAndRoles.ViewModels
bool user_is_current_user_and_fse_admin_and_not_twine_admin = user.Guid == CurrentUser.Guid && user.HasRole(Roles.FSEAdministrator) && !user.HasRole(Roles.FSETwineAdministrator);
var collection = new RolesCollection();
- collection.Add(new RoleModel(roles.SingleOrDefault(x => x.RoleEnum == Roles.FSETechnician)) { IsSelected = isNew});
+ collection.Add(new RoleModel(roles.SingleOrDefault(x => x.RoleEnum == Roles.FSETechnician)) { IsSelected = isNew });
collection.Add(new RoleModel(roles.SingleOrDefault(x => x.RoleEnum == Roles.FSEAdvancedTechnician), Roles.FSETechnician));
collection.Add(new RoleModel(roles.SingleOrDefault(x => x.RoleEnum == Roles.FSEAdministrator), Roles.FSETechnician, Roles.FSEAdvancedTechnician) { IsEnabled = !user_is_current_user_and_fse_admin_and_not_twine_admin });
@@ -273,7 +302,7 @@ namespace Tango.FSE.UsersAndRoles.ViewModels
if (!IsNewUser)
{
- await Services.OrganizationsService.UpdateUser(User);
+ await Services.OrganizationsService.UpdateUser(User, IsResetUserPassword, ResetPassword);
}
else
{
@@ -386,6 +415,8 @@ namespace Tango.FSE.UsersAndRoles.ViewModels
public void OnNavigatedToWithObject(NavigationObject obj)
{
+ IsResetUserPassword = false;
+ ResetPassword = null;
User = null;
IsNewUser = obj.IsNewUser;
Organization = obj.Organization;
diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.UsersAndRoles/Views/UserDetailsView.xaml b/Software/Visual_Studio/FSE/Modules/Tango.FSE.UsersAndRoles/Views/UserDetailsView.xaml
index fe6ba4ea3..0df85dea8 100644
--- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.UsersAndRoles/Views/UserDetailsView.xaml
+++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.UsersAndRoles/Views/UserDetailsView.xaml
@@ -71,6 +71,12 @@
<Button Margin="20 0 0 0" HorizontalAlignment="Left" Width="120" Style="{StaticResource FSE_RaisedButton_Dark_Hover_Accent_Foreground}" Command="{Binding GeneratePasswordCommand}" >GENERATE</Button>
</UniformGrid>
+ <UniformGrid Columns="2" Margin="0 30 0 0" Visibility="{Binding IsResetUserPassword,Converter={StaticResource BooleanToVisibilityConverter}}">
+ <TextBox Margin="0 0 0 0" material:HintAssist.IsFloating="True" material:HintAssist.Hint="Password" IsReadOnly="True" Text="{Binding ResetPassword,NotifyOnValidationError=True,ValidatesOnDataErrors=True,ValidatesOnNotifyDataErrors=True}"></TextBox>
+
+ <Button Margin="20 0 0 0" HorizontalAlignment="Left" Width="120" Style="{StaticResource FSE_RaisedButton_Dark_Hover_Accent_Foreground}" Command="{Binding GenerateResetPasswordCommand}" >GENERATE</Button>
+ </UniformGrid>
+
<UniformGrid Columns="2" Margin="0 30 0 0">
<TextBox Margin="0 0 0 0" material:HintAssist.IsFloating="True" material:HintAssist.Hint="First Name" Text="{Binding FirstName,NotifyOnValidationError=True,ValidatesOnDataErrors=True,ValidatesOnNotifyDataErrors=True}"></TextBox>
@@ -155,6 +161,10 @@
<CheckBox IsChecked="{Binding SendInvitation}" ToolTip="Send the new user invitation to login to this system with the initial password" Foreground="{StaticResource FSE_PrimaryAccentBrush}">Send invitation via email</CheckBox>
</DockPanel>
+ <DockPanel Margin="0 50 0 0" HorizontalAlignment="Center" Visibility="{Binding IsNewUser,Converter={StaticResource BooleanToVisibilityInverseConverter}}">
+ <Button Style="{StaticResource FSE_FlatButton_ForegroundAccentHover}" Foreground="{StaticResource FSE_RedBrush}" Command="{Binding ResetPasswordCommand}" IsEnabled="{Binding IsResetUserPassword,Converter={StaticResource BooleanInverseConverter}}">RESET PASSWORD</Button>
+ </DockPanel>
+
<Button Margin="0 60 0 0" material:ButtonAssist.CornerRadius="25" Width="250" Height="50" Padding="12" Command="{Binding SaveCommand}">
<DockPanel>
<material:PackIcon Kind="ContentSave"/>