private bool _SetUserPassword(User user, string password)
        {
            var ret = _dl.updateUserPassword(user, password) > 0;
              if (ret)
              {
            _user = _dl.getUser(user.id);
              }

              return ret;
        }
 private bool loginControl_click(object sender, EventArgs e)
 {
     var lc = ((LoginControl)sender);
       _user = lc.user;
       if (_ValidateLogin(_user.password, lc.password))
       {
     //logged in
     _Authenticated(_user);
     _user.authed = true;
     return true;
       }
       else
       {
     if (_user.password != string.Empty)
     {
       Messages.defaultError("Invalid login/password", "error");
       return false;
     }
     else if (_user.password == string.Empty && !_SetUserPassword(_user, lc.password.GetHashCode().ToString()))
     {
       Messages.defaultError("Failed to set password", "error");
       return false;
     }
     else
     {
       _Authenticated(_user);
       return true;
     }
       }
 }
 private void _Authenticated(User user)
 {
     user.authed = true;
       _user = user;
       allowanceAccountControl.account = user.account;
       userChanged += new EventHandler(userChanged_event);
 }