Free cookie consent management tool by TermsFeed Policy Generator

Changeset 7651


Ignore:
Timestamp:
03/21/12 15:42:42 (11 years ago)
Author:
ascheibe
Message:

#1648 added reset password and update user operations to the ui

Location:
branches/ClientUserManagement
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/ClientUserManagement/HeuristicLab.Clients.Access.Administration/3.3/Views/UserView.Designer.cs

    r7637 r7651  
    2828      this.userNameTextBox = new System.Windows.Forms.TextBox();
    2929      this.fullNameTextBox = new System.Windows.Forms.TextBox();
     30      this.label3 = new System.Windows.Forms.Label();
     31      this.label4 = new System.Windows.Forms.Label();
     32      this.emailTextBox = new System.Windows.Forms.TextBox();
     33      this.idTextBox = new System.Windows.Forms.TextBox();
     34      this.label5 = new System.Windows.Forms.Label();
     35      this.label6 = new System.Windows.Forms.Label();
     36      this.lastActivityTextBox = new System.Windows.Forms.TextBox();
     37      this.lastLoginTextBox = new System.Windows.Forms.TextBox();
     38      this.resetPasswordButton = new System.Windows.Forms.Button();
    3039      this.SuspendLayout();
    3140      //
     
    5059      // userNameTextBox
    5160      //
    52       this.userNameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
    53             | System.Windows.Forms.AnchorStyles.Right)));
     61      this.userNameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     62                  | System.Windows.Forms.AnchorStyles.Right)));
    5463      this.userNameTextBox.Enabled = false;
    55       this.userNameTextBox.Location = new System.Drawing.Point(72, 3);
     64      this.userNameTextBox.Location = new System.Drawing.Point(76, 3);
    5665      this.userNameTextBox.Name = "userNameTextBox";
    57       this.userNameTextBox.Size = new System.Drawing.Size(289, 20);
     66      this.userNameTextBox.Size = new System.Drawing.Size(285, 20);
    5867      this.userNameTextBox.TabIndex = 2;
    5968      this.userNameTextBox.TextChanged += new System.EventHandler(this.userNameTextBox_TextChanged);
     
    6170      // fullNameTextBox
    6271      //
    63       this.fullNameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
    64             | System.Windows.Forms.AnchorStyles.Right)));
    65       this.fullNameTextBox.Location = new System.Drawing.Point(72, 29);
     72      this.fullNameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     73                  | System.Windows.Forms.AnchorStyles.Right)));
     74      this.fullNameTextBox.Location = new System.Drawing.Point(76, 29);
    6675      this.fullNameTextBox.Name = "fullNameTextBox";
    67       this.fullNameTextBox.Size = new System.Drawing.Size(289, 20);
     76      this.fullNameTextBox.Size = new System.Drawing.Size(285, 20);
    6877      this.fullNameTextBox.TabIndex = 3;
    6978      this.fullNameTextBox.TextChanged += new System.EventHandler(this.fullNameTextBox_TextChanged);
    7079      //
     80      // label3
     81      //
     82      this.label3.AutoSize = true;
     83      this.label3.Location = new System.Drawing.Point(3, 58);
     84      this.label3.Name = "label3";
     85      this.label3.Size = new System.Drawing.Size(39, 13);
     86      this.label3.TabIndex = 4;
     87      this.label3.Text = "E-Mail:";
     88      //
     89      // label4
     90      //
     91      this.label4.AutoSize = true;
     92      this.label4.Location = new System.Drawing.Point(5, 84);
     93      this.label4.Name = "label4";
     94      this.label4.Size = new System.Drawing.Size(19, 13);
     95      this.label4.TabIndex = 5;
     96      this.label4.Text = "Id:";
     97      //
     98      // emailTextBox
     99      //
     100      this.emailTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     101                  | System.Windows.Forms.AnchorStyles.Right)));
     102      this.emailTextBox.Location = new System.Drawing.Point(76, 55);
     103      this.emailTextBox.Name = "emailTextBox";
     104      this.emailTextBox.Size = new System.Drawing.Size(285, 20);
     105      this.emailTextBox.TabIndex = 6;
     106      this.emailTextBox.TextChanged += new System.EventHandler(this.emailTextBox_TextChanged);
     107      //
     108      // idTextBox
     109      //
     110      this.idTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     111                  | System.Windows.Forms.AnchorStyles.Right)));
     112      this.idTextBox.Enabled = false;
     113      this.idTextBox.Location = new System.Drawing.Point(76, 81);
     114      this.idTextBox.Name = "idTextBox";
     115      this.idTextBox.Size = new System.Drawing.Size(285, 20);
     116      this.idTextBox.TabIndex = 7;
     117      //
     118      // label5
     119      //
     120      this.label5.AutoSize = true;
     121      this.label5.Location = new System.Drawing.Point(3, 110);
     122      this.label5.Name = "label5";
     123      this.label5.Size = new System.Drawing.Size(67, 13);
     124      this.label5.TabIndex = 8;
     125      this.label5.Text = "Last Activity:";
     126      //
     127      // label6
     128      //
     129      this.label6.AutoSize = true;
     130      this.label6.Location = new System.Drawing.Point(3, 136);
     131      this.label6.Name = "label6";
     132      this.label6.Size = new System.Drawing.Size(59, 13);
     133      this.label6.TabIndex = 9;
     134      this.label6.Text = "Last Login:";
     135      //
     136      // lastActivityTextBox
     137      //
     138      this.lastActivityTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     139                  | System.Windows.Forms.AnchorStyles.Right)));
     140      this.lastActivityTextBox.Enabled = false;
     141      this.lastActivityTextBox.Location = new System.Drawing.Point(76, 107);
     142      this.lastActivityTextBox.Name = "lastActivityTextBox";
     143      this.lastActivityTextBox.Size = new System.Drawing.Size(285, 20);
     144      this.lastActivityTextBox.TabIndex = 10;
     145      //
     146      // lastLoginTextBox
     147      //
     148      this.lastLoginTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     149                  | System.Windows.Forms.AnchorStyles.Right)));
     150      this.lastLoginTextBox.Enabled = false;
     151      this.lastLoginTextBox.Location = new System.Drawing.Point(76, 133);
     152      this.lastLoginTextBox.Name = "lastLoginTextBox";
     153      this.lastLoginTextBox.Size = new System.Drawing.Size(285, 20);
     154      this.lastLoginTextBox.TabIndex = 11;
     155      //
     156      // resetPasswordButton
     157      //
     158      this.resetPasswordButton.Location = new System.Drawing.Point(6, 159);
     159      this.resetPasswordButton.Name = "resetPasswordButton";
     160      this.resetPasswordButton.Size = new System.Drawing.Size(96, 23);
     161      this.resetPasswordButton.TabIndex = 12;
     162      this.resetPasswordButton.Text = "Reset Password";
     163      this.resetPasswordButton.UseVisualStyleBackColor = true;
     164      this.resetPasswordButton.Click += new System.EventHandler(this.resetPasswordButton_Click);
     165      //
    71166      // UserView
    72167      //
    73168      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    74169      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     170      this.Controls.Add(this.resetPasswordButton);
     171      this.Controls.Add(this.lastLoginTextBox);
     172      this.Controls.Add(this.lastActivityTextBox);
     173      this.Controls.Add(this.label6);
     174      this.Controls.Add(this.label5);
     175      this.Controls.Add(this.idTextBox);
     176      this.Controls.Add(this.emailTextBox);
     177      this.Controls.Add(this.label4);
     178      this.Controls.Add(this.label3);
    75179      this.Controls.Add(this.fullNameTextBox);
    76180      this.Controls.Add(this.userNameTextBox);
     
    78182      this.Controls.Add(this.label1);
    79183      this.Name = "UserView";
    80       this.Size = new System.Drawing.Size(364, 106);
     184      this.Size = new System.Drawing.Size(364, 185);
    81185      this.ResumeLayout(false);
    82186      this.PerformLayout();
     
    90194    private System.Windows.Forms.TextBox userNameTextBox;
    91195    private System.Windows.Forms.TextBox fullNameTextBox;
     196    private System.Windows.Forms.Label label3;
     197    private System.Windows.Forms.Label label4;
     198    private System.Windows.Forms.TextBox emailTextBox;
     199    private System.Windows.Forms.TextBox idTextBox;
     200    private System.Windows.Forms.Label label5;
     201    private System.Windows.Forms.Label label6;
     202    private System.Windows.Forms.TextBox lastActivityTextBox;
     203    private System.Windows.Forms.TextBox lastLoginTextBox;
     204    private System.Windows.Forms.Button resetPasswordButton;
    92205  }
    93206}
  • branches/ClientUserManagement/HeuristicLab.Clients.Access.Administration/3.3/Views/UserView.cs

    r7637 r7651  
    2020#endregion
    2121
     22using System;
     23using System.Windows.Forms;
    2224using HeuristicLab.Core.Views;
    2325using HeuristicLab.MainForm;
     
    4244        userNameTextBox.Clear();
    4345        fullNameTextBox.Clear();
     46        emailTextBox.Clear();
     47        idTextBox.Clear();
     48        lastActivityTextBox.Clear();
     49        lastLoginTextBox.Clear();
    4450      } else {
    4551        userNameTextBox.Text = Content.UserName;
    4652        fullNameTextBox.Text = Content.FullName;
     53        emailTextBox.Text = Content.Email;
     54        idTextBox.Text = Content.Id.ToString();
     55        lastActivityTextBox.Text = Content.LastActivityDate.ToString();
     56        lastLoginTextBox.Text = Content.LastLoginDate.ToString();
    4757      }
    4858    }
     
    5767        Content.UserName = userNameTextBox.Text;
    5868    }
     69
     70    private void emailTextBox_TextChanged(object sender, System.EventArgs e) {
     71      if (Content.Email != emailTextBox.Text)
     72        Content.Email = emailTextBox.Text;
     73    }
     74
     75    private void resetPasswordButton_Click(object sender, System.EventArgs e) {
     76      Action a = new Action(delegate {
     77        string result = AccessAdministrationClient.CallAccessService<string>(s => s.ResetPassword(Content.Id));
     78        ShowPassword(result);
     79      });
     80
     81      AccessAdministrationClient.Instance.ExecuteActionAsync(a, PluginInfrastructure.ErrorHandling.ShowErrorDialog); ;
     82    }
     83
     84    private void ShowPassword(string result) {
     85      if (InvokeRequired) {
     86        Invoke(new Action<string>(ShowPassword), result);
     87      } else {
     88        MessageBox.Show("The new password is: " + result, "Password Reset", MessageBoxButtons.OK, MessageBoxIcon.Information);
     89      }
     90    }
    5991  }
    6092}
  • branches/ClientUserManagement/HeuristicLab.Services.Access/3.3/AccessService.cs

    r7639 r7651  
    567567      RoleVerifier.AuthenticateForAllRoles(AccessServiceRoles.Administrator);
    568568
    569       AddUser(user);
     569      MembershipUser membershipUser = Membership.GetUser((object)user.Id);
     570      if (membershipUser != null) {
     571        membershipUser.Email = user.Email;
     572        membershipUser.IsApproved = user.IsApproved;
     573        membershipUser.Comment = user.Comment;
     574        Membership.UpdateUser(membershipUser);
     575      }
     576
     577      using (DA.AccessServiceDataContext context = new DA.AccessServiceDataContext()) {
     578        var query = from u in context.UserGroupBases.OfType<DA.User>()
     579                    where u.Id == user.Id
     580                    select u;
     581        if (query.Count() > 0) {
     582          DA.User u = query.First();
     583          u.FullName = user.FullName;
     584          context.SubmitChanges();
     585        }
     586      }
    570587    }
    571588
Note: See TracChangeset for help on using the changeset viewer.