Advertisement
Guest User

Untitled

a guest
Mar 9th, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.06 KB | None | 0 0
  1. public static bool LoginUserUsingOpenID(BaseDBContext db, ClaimsResponse r)
  2. {
  3. string email = r.Email;
  4. bool doesntExist = !UserHelper.DoesUserExist(db, r.Email);
  5.  
  6. User u = null;
  7.  
  8. if (doesntExist)
  9. {
  10. u.Email = email;
  11. u.Username = "User" + new Random().Next(100000);
  12. u.Password = CreateRandomPassword(7);
  13. u.prepareForCreationFromThirdParty();
  14. }
  15. else
  16. {
  17. u = db.Users.Where(x => x.Email == r.Email).FirstOrDefault();
  18. }
  19. SetUserAsAuthenticated(u);
  20. AddAutomaticLoginKeyForUser(db, u); //Need to get this to the users frontend somehow..
  21. return true;
  22. }
  23.  
  24. System.NullReferenceException: Object reference not set to an instance of an object.
  25. at MusingMonkey.Helpers.SecurityHelper.LoginUserUsingOpenID(BaseDBContext db, ClaimsResponse r) in C:UsersWilliam-BusinessDesktopTWBTWB CentralProjectsMusingMonkeyMusingMonkeyHelpersSecurityHelper.cs:line 170
  26. at MusingMonkey.Controllers.UsersController.HandleOpenIDResponse() in C:UsersWilliam-BusinessDesktopTWBTWB CentralProjectsMusingMonkeyMusingMonkeyControllersUsersController.cs:line 78
  27. at lambda_method(Closure , ControllerBase , Object[] )
  28. at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
  29. at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
  30. at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
  31. at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass42.<BeginInvokeSynchronousActionMethod>b__41()
  32. at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _)
  33. at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End()
  34. at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
  35. at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass37.<>c__DisplayClass39.<BeginInvokeActionMethodWithFilters>b__33()
  36. at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49()
  37. at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass37.<BeginInvokeActionMethodWithFilters>b__36(IAsyncResult asyncResult)
  38. at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End()
  39. at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult)
  40. at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.<>c__DisplayClass2a.<BeginInvokeAction>b__20()
  41. at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult)
  42.  
  43. User u = null;
  44.  
  45. if (doesntExist)
  46. {
  47. u.Email = email;
  48. ...
  49.  
  50. User u = new User();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement