/// <summary> /// 用户注册(根据参数决定是否开启空间,是否安装应用程序) /// </summary> /// <param name="name">用户名</param> /// <param name="pwd">密码</param> /// <param name="email">电子邮件</param> /// <param name="friendlyUrl">用户的友好网址,可以为空</param> /// <param name="apps">默认开启的应用程序(从 home,blog,photo,microblog,friend,visitor,forumpost,about,feedback,share 中选择)。如果为空,则不安装程序</param> public Result UserRegister( String name, String pwd, String email, String friendlyUrl, String apps ) { if (strUtil.IsNullOrEmpty( name ) || strUtil.IsNullOrEmpty( pwd )) { throw new ArgumentNullException( "请设置用户名和密码" ); } User user = new User(); user.Name = name; user.Pwd = pwd; user.Email = email; user.Url = friendlyUrl == null ? "" : friendlyUrl.ToLower(); Result result = new Result(); UserService userService = new UserService(); if (strUtil.HasText( apps )) { ISiteConfig sconfig = getSiteConfig( true ); userService.Register( user, result, sconfig ); new AppService().InstallAppAndMenu( user, apps ); } else { ISiteConfig sconfig = getSiteConfig( false ); userService.Register( user, result, sconfig ); } result.Info = user; return result; }
/// <summary> /// 用户注册(不开启空间,使用默认的友好网址) /// </summary> /// <param name="name">用户名</param> /// <param name="pwd">密码</param> /// <param name="email">电子邮件</param> public Result UserRegister( String name, String pwd, String email ) { if (strUtil.IsNullOrEmpty( name ) || strUtil.IsNullOrEmpty( pwd )) { throw new ArgumentNullException( "请设置用户名和密码" ); } User user = new User(); user.Name = name; user.Pwd = pwd; user.Email = email; Result result = new Result(); UserService userService = new UserService(); ISiteConfig sconfig = getSiteConfig( false ); userService.Register( user, result, sconfig ); result.Info = user; return result; }