Esempio n. 1
0
 /// <summary>
 /// Вход в систему. Определение ролей и установка необходимых cookies
 /// </summary>
 /// <param name="_account">аккаунт, который входит</param>
 /// <param name="_persist">запоминать ли авторизацию</param>
 public static void SignIn(accounts _account, bool _persist)
 {
     if (_account != null)
     {
         // получим роли для нашего аккаунта
         List<string> roles = GetRoles(_account);
         SetAuthenticationCookie(_account.id, _account.email, _account.ShortName, _persist, roles);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Регистрация
        /// </summary>
        /// <param name="registerData">данные регистрации</param>
        /// <param name="needActivation">признак необходимости активации аккаунта</param>
        public static accounts Register(UserRegistrationModel registerData, bool needActivation = true)
        {
            accounts newAccount = new accounts()
            {
                firstname = registerData.FirstName,
                lastname = registerData.LastName,
                email = registerData.EMailReg,
                created = DateTime.Now,
                role_id = 1,
                salt = Guid.NewGuid(),
                activation_guid = needActivation ? Guid.NewGuid() : Guid.Empty
            };

            newAccount.password = CalculateHash(registerData.Password, newAccount.salt.ToString());

            Meridian.Default.accountsStore.Insert(newAccount);

            return newAccount;
        }
Esempio n. 3
0
 public void LoadAggregations(Meridian _meridian)
 {
     if((account_id > 0) && (_meridian.accountsStore.Exists(account_id)))
     {
         this.u_comments_accounts = _meridian.accountsStore.Get(account_id);;
         this.u_comments_accounts.AddComments(this);
     }
     if((parent_id > 0) && (_meridian.commentsStore.Exists(parent_id)))
     {
         this.cn_child_comments_comments = _meridian.commentsStore.Get(parent_id);;
         this.cn_child_comments_comments.AddChildComments(this);
     }
 }
Esempio n. 4
0
 /// <summary>
 /// Получить списко ролей аккаунта
 /// </summary>
 /// <param name="_account">акканунт</param>
 /// <returns>список</returns>
 public static List<string> GetRoles(accounts _account)
 {
     List<string> roles = new List<string> { "0" };
     return roles;
 }
Esempio n. 5
0
 public void LoadAggregations(Meridian _meridian)
 {
     if((account_id > 0) && (_meridian.accountsStore.Exists(account_id)))
     {
         this.account_questions_accounts = _meridian.accountsStore.Get(account_id);;
         this.account_questions_accounts.AddQuestions(this);
     }
     if((replier_account_id > 0) && (_meridian.accountsStore.Exists(replier_account_id)))
     {
         this.account_answers_accounts = _meridian.accountsStore.Get(replier_account_id);;
         this.account_answers_accounts.AddAnswers(this);
     }
 }