Example #1
0
 public ActionResult Update(Bam.Net.UserAccounts.Data.Password dao)
 {
     try
     {
         dao.Save();
         return(Json(new { Success = true, Message = "", Dao = dao.ToJsonSafe() }));
     }
     catch (Exception ex)
     {
         return(GetErrorResult(ex));
     }
 }
Example #2
0
        private static Password CreateFromFilter(IQueryFilter filter, Database database = null)
        {
            Database db  = database ?? Db.For <Password>();
            var      dao = new Password();

            filter.Parameters.Each(p =>
            {
                dao.Property(p.ColumnName, p.Value);
            });
            dao.Save(db);
            return(dao);
        }
Example #3
0
        /// <summary>
        /// Saves the hash of the specified password
        /// </summary>
        /// <param name="user"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public static Password Set(User user, string password, Database db = null)
        {
            Password passwordEntry = user.PasswordsByUserId.FirstOrDefault();//Password.OneWhere(c => c.UserId == user.Id);

            if (passwordEntry == null)
            {
                passwordEntry = user.PasswordsByUserId.AddNew();
            }

            passwordEntry.Value = password.Sha1();
            passwordEntry.Save(db);
            return(passwordEntry);
        }