Line | |
---|
1 | using HeuristicLab.Clients.Access.Administration;
|
---|
2 | using HeuristicLab.Clients.Hive.WebJobManager.Controllers;
|
---|
3 | using HeuristicLab.Clients.Hive.WebJobManager.Services;
|
---|
4 | using HeuristicLab.Clients.Hive.WebJobManager.ViewModels.User;
|
---|
5 | using Microsoft.AspNet.SignalR;
|
---|
6 | using System;
|
---|
7 | using System.Collections.Generic;
|
---|
8 | using System.Linq;
|
---|
9 | using System.Threading.Tasks;
|
---|
10 |
|
---|
11 | namespace HeuristicLab.Clients.Hive.WebJobManager.Hubs
|
---|
12 | {
|
---|
13 | /// <summary>
|
---|
14 | /// Small SignalR hub to change the password from a user
|
---|
15 | /// </summary>
|
---|
16 | public class UserInfoHub: Hub
|
---|
17 | {
|
---|
18 | private WebLoginService weblog;
|
---|
19 | private Guid userId;
|
---|
20 | private AccessAdministrationClient aac;
|
---|
21 | /// <summary>
|
---|
22 | /// Loads required services
|
---|
23 | /// </summary>
|
---|
24 | private void loader()
|
---|
25 | {
|
---|
26 | weblog = WebLoginService.Instance;
|
---|
27 | string uid = Context.QueryString["userid"];
|
---|
28 | if (uid == null || uid == "" || Guid.Parse(uid) == Guid.Empty)
|
---|
29 | {
|
---|
30 | userId = Guid.Empty;
|
---|
31 | }
|
---|
32 | else
|
---|
33 | {
|
---|
34 | userId = Guid.Parse(uid);
|
---|
35 | aac = weblog.getAccessAdminClient(userId);
|
---|
36 | }
|
---|
37 | }
|
---|
38 | /// <summary>
|
---|
39 | /// Request to change pass
|
---|
40 | /// </summary>
|
---|
41 | /// <param name="user">User id</param>
|
---|
42 | public void resetPassword(string user)
|
---|
43 | {
|
---|
44 | loader();
|
---|
45 | Guid userid = Guid.Parse(user);
|
---|
46 | Access.User u = new UserViewModel(aac).refreshUsers().getUserById(userid);
|
---|
47 | var pass = aac.resetPassword(userid);
|
---|
48 | UserController.sendPassmail(u, pass);//Send mail + show pass
|
---|
49 | Clients.Caller.showNewPass(pass);
|
---|
50 | }
|
---|
51 | }
|
---|
52 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.