Exemple #1
0
        private void SaveInformation(string pToken, string pTokenSecret, string pPass, string pName, string pEmail,
                                     LoginType pLoginType)
        {
            var session = HttpContext.Current.Session;

            if (session[LGTConsts.LGTApplicationVariableName.LoggedUserKey] != null)
            {
                return;
            }
            var args = new LGTExecuteLoginEventArgs
            {
                Autenticated = pLoginType != LoginType.Owner,
                Email        = pEmail,
                Pass         = pPass,
                Name         = pName,
                LoginType    = pLoginType
            };

            if (pLoginType == LoginType.Owner)
            {
                args = InvokeExecuteLogin(args);
            }
            if (args.Autenticated)
            {
                session[LGTConsts.LGTApplicationVariableName.LoggedUserKey] = new LoggedInformation
                {
                    Token       = pToken,
                    TokenSecret = pTokenSecret,
                    Name        = pName,
                    Email       = pEmail,
                    LoginType   = pLoginType,
                    Key         = args.Id
                };

                FormsAuthentication.RedirectFromLoginPage(string.IsNullOrEmpty(pName) ? pEmail : pName, false);
            }
        }
Exemple #2
0
        private LGTExecuteLoginEventArgs InvokeExecuteLogin(LGTExecuteLoginEventArgs args)
        {
            var handler = ExecuteLogin;

            return(handler != null?handler(this, args) : args);
        }