· 7 years ago · Apr 30, 2018, 01:36 PM
1 [AllowAnonymous]
2 public virtual ActionResult ClearCacheFromExternal(string JwtToken) //int UserID, bool SendMail = false
3 {
4 try
5 {
6 var SecretKey = new byte[] { 164, 60, 194, 0, 161, 189, 41, 38, 130, 89, 141, 164, 45, 170, 159, 209, 69, 137, 243, 216, 191, 131, 47, 250, 32, 107, 231, 117, 37, 158, 225, 111 };
7 string Decrypted = Jose.JWT.Decode(JwtToken, SecretKey);
8 var ParamsDictionary = new JavaScriptSerializer().Deserialize<Dictionary<string, object>>(Decrypted);
9 int UserID = CConverter.GetIntFromObject(ParamsDictionary["UserID"]);
10 if (UserID > 0)
11 {
12 User model = UserDB.GetSingle(UserID);
13 SessionHelper.CurrentUser = model;
14 ClearCache();
15 }
16 }
17 catch (Exception ex)
18 {
19 log.Error(ex.Message);
20 }
21 return null;
22 }