/// <summary> /// Send an Private Message to the Newly Created User with /// his Account Info (Pass, Security Question and Answer) /// </summary> /// <param name="user"> /// The user. /// </param> /// <param name="pass"> /// The pass. /// </param> /// <param name="securityAnswer"> /// The security answer. /// </param> /// <param name="userId"> /// The user Id. /// </param> /// <param name="oAuth"> /// The oAUTH. /// </param> private static void SendRegistrationMessageToTwitterUser( [NotNull] MembershipUser user, [NotNull] string pass, [NotNull] string securityAnswer, [NotNull] int userId, OAuthTwitter oAuth) { var subject = string.Format( YafContext.Current.Get <ILocalization>().GetText("COMMON", "NOTIFICATION_ON_NEW_FACEBOOK_USER_SUBJECT"), YafContext.Current.Get <BoardSettings>().Name); var notifyUser = new TemplateEmail { TemplateParams = { ["{user}"] = user.UserName, ["{email}"] = user.Email, ["{pass}"] = pass, ["{answer}"] = securityAnswer, ["{forumname}"] = YafContext.Current.Get <BoardSettings>().Name } }; var emailBody = notifyUser.ProcessTemplate("NOTIFICATION_ON_TWITTER_REGISTER"); var messageFlags = new MessageFlags { IsHtml = false, IsBBCode = true }; // Send Message also as DM to Twitter. var tweetApi = new TweetAPI(oAuth); var message = $"{subject}. {YafContext.Current.Get<ILocalization>().GetText("LOGIN", "TWITTER_DM")}"; if (YafContext.Current.Get <BoardSettings>().AllowPrivateMessages) { YafContext.Current.GetRepository <PMessage>().SendMessage(2, userId, subject, emailBody, messageFlags.BitValue, -1); } else { message = YafContext.Current.Get <ILocalization>() .GetTextFormatted( "LOGIN", "TWITTER_DM_ACCOUNT", YafContext.Current.Get <BoardSettings>().Name, user.UserName, pass); } try { tweetApi.SendDirectMessage(TweetAPI.ResponseFormat.json, user.UserName, message.Truncate(140)); } catch (Exception ex) { YafContext.Current.Get <ILogger>().Error(ex, "Error while sending Twitter DM Message"); } }
/// <summary> /// Generates the login URL. /// </summary> /// <param name="generatePopUpUrl"> /// if set to <c>true</c> [generate pop up URL]. /// </param> /// <param name="connectCurrentUser"> /// if set to <c>true</c> [connect current user]. /// </param> /// <returns> /// Returns the Login URL /// </returns> public string GenerateLoginUrl(bool generatePopUpUrl, bool connectCurrentUser = false) { var oAuth = new OAuthTwitter { CallBackUrl = $"{BoardInfo.ForumBaseUrl}auth.aspx?auth={AuthService.twitter}{(connectCurrentUser ? "&connectCurrent=true" : string.Empty)}", ConsumerKey = Config.TwitterConsumerKey, ConsumerSecret = Config.TwitterConsumerSecret }; return(generatePopUpUrl ? $"javascript:window.open('{oAuth.AuthorizationLinkGet()}', 'Twitter Login Window', 'width=800,height=700,left=150,top=100,scrollbar=no,resize=no'); return false;" : oAuth.AuthorizationLinkGet()); }
/// <summary> /// Generates the login URL. /// </summary> /// <param name="generatePopUpUrl"> /// if set to <c>true</c> [generate pop up URL]. /// </param> /// <param name="connectCurrentUser"> /// if set to <c>true</c> [connect current user]. /// </param> /// <returns> /// Returns the Login URL /// </returns> public string GenerateLoginUrl(bool generatePopUpUrl, bool connectCurrentUser = false) { var oAuth = new OAuthTwitter { CallBackUrl = "{0}auth.aspx?auth={1}{2}".FormatWith( YafForumInfo.ForumBaseUrl, AuthService.twitter, connectCurrentUser ? "&connectCurrent=true" : string.Empty), ConsumerKey = Config.TwitterConsumerKey, ConsumerSecret = Config.TwitterConsumerSecret }; return generatePopUpUrl ? "javascript:window.open('{0}', 'Twitter Login Window', 'width=800,height=700,left=150,top=100,scrollbar=no,resize=no'); return false;" .FormatWith(oAuth.AuthorizationLinkGet()) : oAuth.AuthorizationLinkGet(); }
/// <summary> /// Call the Events when the Twitter Login was Successfully /// </summary> /// <param name="newUser"> /// The new user. /// </param> /// <param name="oAuth"> /// The twitter oAUTH. /// </param> /// <param name="userId"> /// The user id. /// </param> /// <param name="user"> /// The user. /// </param> private static void LoginTwitterSuccess( [NotNull] bool newUser, [NotNull] OAuthTwitter oAuth, [NotNull] int userId, [CanBeNull] MembershipUser user) { if (newUser) { YafContext.Current.Get <IRaiseEvent>().Raise(new NewUserRegisteredEvent(user, userId)); } else { // Clearing cache with old Active User Lazy Data ... YafContext.Current.Get <IDataCache>().Remove(Constants.Cache.ActiveUserLazyData.FormatWith(userId)); } // Store Tokens in Session (Could Bes Stored in DB but it would be a Security Problem) YafContext.Current.Get <IYafSession>().TwitterToken = oAuth.Token; YafContext.Current.Get <IYafSession>().TwitterTokenSecret = oAuth.TokenSecret; YafSingleSignOnUser.LoginSuccess(AuthService.twitter, user.UserName, userId, true); }
/// <summary> /// Connects the user. /// </summary> /// <param name="request">The request.</param> /// <param name="parameters">The parameters.</param> /// <param name="message">The message.</param> /// <returns> /// Returns if the connect was successful or not /// </returns> public bool ConnectUser(HttpRequest request, string parameters, out string message) { var oAuth = new OAuthTwitter { ConsumerKey = Config.TwitterConsumerKey, ConsumerSecret = Config.TwitterConsumerSecret }; // Get the access token and secret. oAuth.AccessTokenGet(request["oauth_token"], request["oauth_verifier"]); if (oAuth.TokenSecret.Length > 0) { var tweetAPI = new TweetAPI(oAuth); var twitterUser = tweetAPI.GetUser(); if (twitterUser.UserId > 0) { // Create User if not exists?! if (!YafContext.Current.IsGuest && !YafContext.Current.Get <YafBoardSettings>().DisableRegistrations) { // Because twitter doesnt provide the email we need to match the user name... if (twitterUser.UserName != YafContext.Current.Profile.UserName) { message = YafContext.Current.Get <ILocalization>() .GetText("LOGIN", "SSO_TWITTERNAME_NOTMATCH"); return(false); } // Update profile with twitter informations YafUserProfile userProfile = YafContext.Current.Profile; userProfile.TwitterId = twitterUser.UserId.ToString(); userProfile.Twitter = twitterUser.UserName; userProfile.Homepage = twitterUser.Url.IsSet() ? twitterUser.Url : "http://twitter.com/{0}".FormatWith(twitterUser.UserName); userProfile.RealName = twitterUser.Name; userProfile.Interests = twitterUser.Description; userProfile.Location = twitterUser.Location; userProfile.Save(); // save avatar if (twitterUser.ProfileImageUrl.IsSet()) { LegacyDb.user_saveavatar( YafContext.Current.PageUserID, twitterUser.ProfileImageUrl, null, null); } YafSingleSignOnUser.LoginSuccess(AuthService.twitter, null, YafContext.Current.PageUserID, false); message = string.Empty; return(true); } } } message = YafContext.Current.Get <ILocalization>().GetText("LOGIN", "SSO_TWITTER_FAILED"); return(false); }
/// <summary> /// The options menu_ item click. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The Pop Event Arguments.</param> private void ShareMenu_ItemClick([NotNull] object sender, [NotNull] PopEventArgs e) { var topicUrl = YafBuildLink.GetLinkNotEscaped(ForumPages.posts, true, "t={0}", this.PageContext.PageTopicID); switch (e.Item.ToLower()) { case "email": this.EmailTopic_Click(sender, e); break; case "tumblr": { // process message... clean html, strip html, remove bbcode, etc... var tumblrMsg = BBCodeHelper.StripBBCode( HtmlHelper.StripHtml(HtmlHelper.CleanHtmlString((string)this._topic["Topic"]))).RemoveMultipleWhitespace(); var meta = this.Page.Header.FindControlType<HtmlMeta>(); string description = string.Empty; if (meta.Any(x => x.Name.Equals("description"))) { var descriptionMeta = meta.FirstOrDefault(x => x.Name.Equals("description")); if (descriptionMeta != null) { description = "&description={0}".FormatWith(descriptionMeta.Content); } } var tumblrUrl = "http://www.tumblr.com/share/link?url={0}&name={1}{2}".FormatWith( this.Server.UrlEncode(topicUrl), tumblrMsg, description); this.Get<HttpResponseBase>().Redirect(tumblrUrl); } break; case "retweet": { var twitterName = this.Get<YafBoardSettings>().TwitterUserName.IsSet() ? "@{0} ".FormatWith(this.Get<YafBoardSettings>().TwitterUserName) : string.Empty; // process message... clean html, strip html, remove bbcode, etc... var twitterMsg = BBCodeHelper.StripBBCode( HtmlHelper.StripHtml(HtmlHelper.CleanHtmlString((string)this._topic["Topic"]))).RemoveMultipleWhitespace(); var tweetUrl = "http://twitter.com/share?url={0}&text={1}".FormatWith( this.Server.UrlEncode(topicUrl), this.Server.UrlEncode( "RT {1}Thread: {0}".FormatWith(twitterMsg.Truncate(100), twitterName))); // Send Retweet Directlly thru the Twitter API if User is Twitter User if (Config.TwitterConsumerKey.IsSet() && Config.TwitterConsumerSecret.IsSet() && this.Get<IYafSession>().TwitterToken.IsSet() && this.Get<IYafSession>().TwitterTokenSecret.IsSet() && this.PageContext.IsTwitterUser) { var oAuth = new OAuthTwitter { ConsumerKey = Config.TwitterConsumerKey, ConsumerSecret = Config.TwitterConsumerSecret, Token = this.Get<IYafSession>().TwitterToken, TokenSecret = this.Get<IYafSession>().TwitterTokenSecret }; var tweets = new TweetAPI(oAuth); tweets.UpdateStatus( TweetAPI.ResponseFormat.json, this.Server.UrlEncode( "RT {1}: {0} {2}".FormatWith(twitterMsg.Truncate(100), twitterName, topicUrl)), string.Empty); } else { this.Get<HttpResponseBase>().Redirect(tweetUrl); } } break; case "digg": { var diggUrl = "http://digg.com/submit?url={0}&title={1}".FormatWith( this.Server.UrlEncode(topicUrl), this.Server.UrlEncode((string)this._topic["Topic"])); this.Get<HttpResponseBase>().Redirect(diggUrl); } break; case "reddit": { var redditUrl = "http://www.reddit.com/submit?url={0}&title={1}".FormatWith( this.Server.UrlEncode(topicUrl), this.Server.UrlEncode((string)this._topic["Topic"])); this.Get<HttpResponseBase>().Redirect(redditUrl); } break; case "googleplus": { var googlePlusUrl = "https://plusone.google.com/_/+1/confirm?hl=en&url={0}".FormatWith( this.Server.UrlEncode(topicUrl)); this.Get<HttpResponseBase>().Redirect(googlePlusUrl); } break; default: throw new ApplicationException(e.Item); } }
/// <summary> /// Initializes a new instance of the <see cref="TweetAPI"/> class. /// Create, Update, retrieve, delete tweets(status messages) using this class /// </summary> /// <param name="_oauth"> /// An authorized and authenticated OAUTH token /// </param> public TweetAPI(OAuthTwitter _oauth) { this.oAuth = _oauth; }
/// <summary> /// Logins the or create user. /// </summary> /// <param name="request"> /// The request. /// </param> /// <param name="parameters"> /// The parameters. /// </param> /// <param name="message"> /// The message. /// </param> /// <returns> /// Returns if Login was successful or not /// </returns> public bool LoginOrCreateUser(HttpRequest request, string parameters, out string message) { var oAuth = new OAuthTwitter { ConsumerKey = Config.TwitterConsumerKey, ConsumerSecret = Config.TwitterConsumerSecret }; // Get the access token and secret. oAuth.AccessTokenGet(request["oauth_token"], request["oauth_verifier"]); if (oAuth.TokenSecret.Length > 0) { var tweetAPI = new TweetAPI(oAuth); var twitterUser = tweetAPI.GetUser(); if (twitterUser.UserId > 0) { // Check if user exists var checkUser = YafContext.Current.Get<MembershipProvider>().GetUser(twitterUser.UserName, false); // Login user if exists if (checkUser == null) { return CreateTwitterUser(twitterUser, oAuth, out message); } // LOGIN Existing User var yafUser = YafUserProfile.GetProfile(checkUser.UserName); var yafUserData = new CombinedUserDataHelper(checkUser); if (yafUser.Twitter.IsNotSet() && yafUser.TwitterId.IsNotSet()) { // user with the same name exists but account is not connected, exit! message = YafContext.Current.Get<ILocalization>().GetText("LOGIN", "SSO_TWITTER_FAILED"); return false; } if (yafUser.Twitter.Equals(twitterUser.UserName) && yafUser.TwitterId.Equals(twitterUser.UserId.ToString())) { LoginTwitterSuccess(false, oAuth, yafUserData.UserID, checkUser); message = string.Empty; return true; } message = YafContext.Current.Get<ILocalization>().GetText("LOGIN", "SSO_TWITTERID_NOTMATCH"); return false; // User does not exist create new user } } message = YafContext.Current.Get<ILocalization>().GetText("LOGIN", "SSO_TWITTER_FAILED"); return false; }
// /// <summary> // /// Retweets Message thru the Twitter API // /// </summary> // /// <param name="sender"> // /// The source of the event. // /// </param> // /// <param name="e"> // /// The <see cref="System.EventArgs"/> instance containing the event data. // /// </param> protected void Retweet_Click(object sender, EventArgs e) { var twitterName = this.Get<YafBoardSettings>().TwitterUserName.IsSet() ? "@{0} ".FormatWith(this.Get<YafBoardSettings>().TwitterUserName) : string.Empty; //breaks here var twitterMsg = BBCodeHelper.StripBBCode( HtmlHelper.StripHtml(HtmlHelper.CleanHtmlString(this.PostInformation))).RemoveMultipleWhitespace(); if (Config.TwitterConsumerKey.IsSet() && Config.TwitterConsumerSecret.IsSet() && this.Get<IYafSession>().TwitterToken.IsSet() && this.Get<IYafSession>().TwitterTokenSecret.IsSet() && this.Get<IYafSession>().TwitterTokenSecret.IsSet() && this.PageContext.IsTwitterUser) { var oAuth = new OAuthTwitter { ConsumerKey = Config.TwitterConsumerKey, ConsumerSecret = Config.TwitterConsumerSecret, Token = this.Get<IYafSession>().TwitterToken, TokenSecret = this.Get<IYafSession>().TwitterTokenSecret }; var tweets = new TweetAPI(oAuth); tweets.UpdateStatus( TweetAPI.ResponseFormat.json, this.Server.UrlEncode("RT {1}: {0} {2}".FormatWith(twitterMsg.Truncate(100), twitterName, HttpContext.Current.Request.Url.AbsoluteUri)), string.Empty); } else { this.Get<HttpResponseBase>().Redirect( "http://twitter.com/share?url={0}&text={1}".FormatWith( this.Server.UrlEncode(this.Get<HttpRequestBase>().Url.ToString()), this.Server.UrlEncode( "RT {1}: {0} {2}".FormatWith(twitterMsg.Truncate(100), twitterName, HttpContext.Current.Request.Url.AbsoluteUri)))); } }
/// <summary> /// Logins the or create user. /// </summary> /// <param name="request">The request.</param> /// <param name="parameters">The parameters.</param> /// <param name="message">The message.</param> /// <returns> /// Returns if Login was successful or not /// </returns> public bool LoginOrCreateUser(HttpRequest request, string parameters, out string message) { var oAuth = new OAuthTwitter { ConsumerKey = Config.TwitterConsumerKey, ConsumerSecret = Config.TwitterConsumerSecret }; // Get the access token and secret. oAuth.AccessTokenGet(request["oauth_token"], request["oauth_verifier"]); if (oAuth.TokenSecret.Length > 0) { var tweetAPI = new TweetAPI(oAuth); var twitterUser = tweetAPI.GetUser(); if (twitterUser.UserId > 0) { // Check if user exists var checkUser = YafContext.Current.Get <MembershipProvider>().GetUser(twitterUser.UserName, false); // Login user if exists if (checkUser == null) { return(CreateTwitterUser(twitterUser, oAuth, out message)); } // LOGIN Existing User var yafUser = YafUserProfile.GetProfile(checkUser.UserName); var yafUserData = new CombinedUserDataHelper(checkUser); if (yafUser.Twitter.IsNotSet() && yafUser.TwitterId.IsNotSet()) { // user with the same name exists but account is not conncected, exit! message = YafContext.Current.Get <ILocalization>().GetText("LOGIN", "SSO_TWITTER_FAILED"); return(false); } if (yafUser.Twitter.Equals(twitterUser.UserName) && yafUser.TwitterId.Equals(twitterUser.UserId.ToString())) { LoginTwitterSuccess(false, oAuth, yafUserData.UserID, checkUser); message = string.Empty; return(true); } message = YafContext.Current.Get <ILocalization>().GetText("LOGIN", "SSO_TWITTERID_NOTMATCH"); return(false); // User does not exist create new user } } message = YafContext.Current.Get <ILocalization>().GetText("LOGIN", "SSO_TWITTER_FAILED"); return(false); }
/// <summary> /// Connects the user. /// </summary> /// <param name="request"> /// The request. /// </param> /// <param name="parameters"> /// The parameters. /// </param> /// <param name="message"> /// The message. /// </param> /// <returns> /// Returns if the connect was successful or not /// </returns> public bool ConnectUser(HttpRequest request, string parameters, out string message) { var oAuth = new OAuthTwitter { ConsumerKey = Config.TwitterConsumerKey, ConsumerSecret = Config.TwitterConsumerSecret }; // Get the access token and secret. oAuth.AccessTokenGet(request["oauth_token"], request["oauth_verifier"]); if (oAuth.TokenSecret.Length > 0) { var tweetAPI = new TweetAPI(oAuth); var twitterUser = tweetAPI.GetUser(); if (twitterUser.UserId > 0) { // Create User if not exists?! if (!YafContext.Current.IsGuest && !YafContext.Current.Get<YafBoardSettings>().DisableRegistrations) { // Because twitter doesn't provide the email we need to match the user name... if (twitterUser.UserName != YafContext.Current.Profile.UserName) { message = YafContext.Current.Get<ILocalization>() .GetText("LOGIN", "SSO_TWITTERNAME_NOTMATCH"); return false; } // Update profile with twitter informations YafUserProfile userProfile = YafContext.Current.Profile; userProfile.TwitterId = twitterUser.UserId.ToString(); userProfile.Twitter = twitterUser.UserName; userProfile.Homepage = twitterUser.Url.IsSet() ? twitterUser.Url : "http://twitter.com/{0}".FormatWith(twitterUser.UserName); userProfile.RealName = twitterUser.Name; userProfile.Interests = twitterUser.Description; userProfile.Location = twitterUser.Location; userProfile.Save(); // save avatar if (twitterUser.ProfileImageUrl.IsSet()) { LegacyDb.user_saveavatar( YafContext.Current.PageUserID, twitterUser.ProfileImageUrl, null, null); } YafSingleSignOnUser.LoginSuccess(AuthService.twitter, null, YafContext.Current.PageUserID, false); message = string.Empty; return true; } } } message = YafContext.Current.Get<ILocalization>().GetText("LOGIN", "SSO_TWITTER_FAILED"); return false; }
/// <summary> /// Creates the or assign twitter user. /// </summary> /// <param name="twitterUser"> /// The twitter user. /// </param> /// <param name="oAuth"> /// The oAUTH. /// </param> /// <param name="message"> /// The message. /// </param> /// <returns> /// Returns if the login was successfully or not /// </returns> private static bool CreateTwitterUser(TwitterUser twitterUser, OAuthTwitter oAuth, out string message) { if (BoardContext.Current.Get <BoardSettings>().DisableRegistrations) { message = BoardContext.Current.Get <ILocalization>().GetText("LOGIN", "SSO_FAILED"); return(false); } // Create User if not exists?! Doesn't work because there is no Email var email = $"{twitterUser.UserName}@twitter.com"; // Check user for bot /*var spamChecker = new YafSpamCheck(); * string result; * var isPossibleSpamBot = false; * * var userIpAddress = BoardContext.Current.Get<HttpRequestBase>().GetUserRealIPAddress(); * * // Check content for spam * if (spamChecker.CheckUserForSpamBot(twitterUser.UserName, twitterUser.Email, userIpAddress, out result)) * { * BoardContext.Current.Get<ILogger>().Log( * null, * "Bot Detected", * "Bot Check detected a possible SPAM BOT: (user name : '{0}', email : '{1}', ip: '{2}', reason : {3}), user was rejected." * .FormatWith(twitterUser.UserName, twitterUser.Email, userIpAddress, result), * EventLogTypes.SpamBotDetected); * * if (BoardContext.Current.Get<BoardSettings>().BotHandlingOnRegister.Equals(1)) * { * // Flag user as spam bot * isPossibleSpamBot = true; * } * else if (BoardContext.Current.Get<BoardSettings>().BotHandlingOnRegister.Equals(2)) * { * message = BoardContext.Current.Get<ILocalization>().GetText("BOT_MESSAGE"); * * if (!BoardContext.Current.Get<BoardSettings>().BanBotIpOnDetection) * { * return false; * } * * BoardContext.Current.GetRepository<BannedIP>() * .Save( * null, * userIpAddress, * "A spam Bot who was trying to register was banned by IP {0}".FormatWith(userIpAddress), * BoardContext.Current.PageUserID); * * // Clear cache * BoardContext.Current.Get<IDataCache>().Remove(Constants.Cache.BannedIP); * * if (BoardContext.Current.Get<BoardSettings>().LogBannedIP) * { * BoardContext.Current.Get<ILogger>() * .Log( * null, * "IP BAN of Bot During Registration", * "A spam Bot who was trying to register was banned by IP {0}".FormatWith( * userIpAddress), * EventLogTypes.IpBanSet); * } * * return false; * } * }*/ // Create User if not exists?! var memberShipProvider = BoardContext.Current.Get <MembershipProvider>(); var pass = Membership.GeneratePassword(32, 16); var securityAnswer = Membership.GeneratePassword(64, 30); var user = memberShipProvider.CreateUser( twitterUser.UserName, pass, email, memberShipProvider.RequiresQuestionAndAnswer ? "Answer is a generated Pass" : null, memberShipProvider.RequiresQuestionAndAnswer ? securityAnswer : null, true, null, out _); // setup initial roles (if any) for this user RoleMembershipHelper.SetupUserRoles(BoardContext.Current.PageBoardID, twitterUser.UserName); // create the user in the YAF DB as well as sync roles... var userID = RoleMembershipHelper.CreateForumUser(user, BoardContext.Current.PageBoardID); // create empty profile just so they have one var userProfile = Utils.UserProfile.GetProfile(twitterUser.UserName); // setup their initial profile information userProfile.Save(); userProfile.TwitterId = twitterUser.UserId.ToString(); userProfile.Twitter = twitterUser.UserName; userProfile.Homepage = twitterUser.Url.IsSet() ? twitterUser.Url : $"http://twitter.com/{twitterUser.UserName}"; userProfile.RealName = twitterUser.Name; userProfile.Interests = twitterUser.Description; userProfile.Location = twitterUser.Location; if (BoardContext.Current.Get <BoardSettings>().EnableIPInfoService) { var userIpLocator = BoardContext.Current.Get <IIpInfoService>().GetUserIpLocator(); if (userIpLocator != null) { userProfile.Country = userIpLocator["CountryCode"]; var location = new StringBuilder(); if (userIpLocator["RegionName"] != null && userIpLocator["RegionName"].IsSet() && !userIpLocator["RegionName"].Equals("-")) { location.Append(userIpLocator["RegionName"]); } if (userIpLocator["CityName"] != null && userIpLocator["CityName"].IsSet() && !userIpLocator["CityName"].Equals("-")) { location.AppendFormat(", {0}", userIpLocator["CityName"]); } userProfile.Location = location.ToString(); } } userProfile.Save(); if (userID == null) { // something is seriously wrong here -- redirect to failure... message = BoardContext.Current.Get <ILocalization>().GetText("LOGIN", "SSO_TWITTER_FAILED"); return(false); } if (BoardContext.Current.Get <BoardSettings>().NotificationOnUserRegisterEmailList.IsSet()) { // send user register notification to the following admin users... BoardContext.Current.Get <ISendNotification>().SendRegistrationNotificationEmail(user, userID.Value); } // save the time zone... var userId = UserMembershipHelper.GetUserIDFromProviderUserKey(user.ProviderUserKey); // send user register notification to the following admin users... SendRegistrationMessageToTwitterUser(user, pass, securityAnswer, userId, oAuth); var autoWatchTopicsEnabled = BoardContext.Current.Get <BoardSettings>().DefaultNotificationSetting == UserNotificationSetting.TopicsIPostToOrSubscribeTo; BoardContext.Current.GetRepository <User>().Save( userId, BoardContext.Current.PageBoardID, twitterUser.UserName, twitterUser.UserName, email, TimeZoneInfo.Local.Id, null, null, null, null); // save the settings... BoardContext.Current.GetRepository <User>().SaveNotification( userId, true, autoWatchTopicsEnabled, BoardContext.Current.Get <BoardSettings>().DefaultNotificationSetting.ToInt(), BoardContext.Current.Get <BoardSettings>().DefaultSendDigestEmail); // save avatar if (twitterUser.ProfileImageUrl.IsSet()) { BoardContext.Current.GetRepository <User>().SaveAvatar(userId, twitterUser.ProfileImageUrl, null, null); } LoginTwitterSuccess(true, oAuth, userId, user); message = BoardContext.Current.Get <ILocalization>().GetText("LOGIN", "UPDATE_EMAIL"); return(true); }
/// <summary> /// Creates the or assign twitter user. /// </summary> /// <param name="twitterUser">The twitter user.</param> /// <param name="oAuth">The oAUTH.</param> /// <param name="message">The message.</param> /// <returns> /// Returns if the login was successfully or not /// </returns> private static bool CreateTwitterUser(TwitterUser twitterUser, OAuthTwitter oAuth, out string message) { if (YafContext.Current.Get<YafBoardSettings>().DisableRegistrations) { message = YafContext.Current.Get<ILocalization>().GetText("LOGIN", "SSO_FAILED"); return false; } // Create User if not exists?! Doesnt work because there is no Email var email = "{0}@twitter.com".FormatWith(twitterUser.UserName); // Create User if not exists?! MembershipCreateStatus status; var pass = Membership.GeneratePassword(32, 16); var securityAnswer = Membership.GeneratePassword(64, 30); MembershipUser user = YafContext.Current.Get<MembershipProvider>() .CreateUser( twitterUser.UserName, pass, email, "Answer is a generated Pass", securityAnswer, true, null, out status); // setup inital roles (if any) for this user RoleMembershipHelper.SetupUserRoles(YafContext.Current.PageBoardID, twitterUser.UserName); // create the user in the YAF DB as well as sync roles... int? userID = RoleMembershipHelper.CreateForumUser(user, YafContext.Current.PageBoardID); // create empty profile just so they have one YafUserProfile userProfile = YafUserProfile.GetProfile(twitterUser.UserName); userProfile.TwitterId = twitterUser.UserId.ToString(); userProfile.Twitter = twitterUser.UserName; userProfile.Homepage = twitterUser.Url.IsSet() ? twitterUser.Url : "http://twitter.com/{0}".FormatWith(twitterUser.UserName); userProfile.RealName = twitterUser.Name; userProfile.Interests = twitterUser.Description; userProfile.Location = twitterUser.Location; userProfile.Save(); // setup their inital profile information userProfile.Save(); if (userID == null) { // something is seriously wrong here -- redirect to failure... message = YafContext.Current.Get<ILocalization>().GetText("LOGIN", "SSO_TWITTER_FAILED"); return false; } if (YafContext.Current.Get<YafBoardSettings>().NotificationOnUserRegisterEmailList.IsSet()) { // send user register notification to the following admin users... YafSingleSignOnUser.SendRegistrationNotificationEmail(user, userID.Value); } // save the time zone... int userId = UserMembershipHelper.GetUserIDFromProviderUserKey(user.ProviderUserKey); // send user register notification to the following admin users... SendRegistrationMessageToTwitterUser(user, pass, securityAnswer, userId, oAuth); LegacyDb.user_save( userId, YafContext.Current.PageBoardID, twitterUser.UserName, null, email, 0, null, null, null, null, null, null, null, null, null, null, null); bool autoWatchTopicsEnabled = YafContext.Current.Get<YafBoardSettings>().DefaultNotificationSetting == UserNotificationSetting.TopicsIPostToOrSubscribeTo; // save the settings... LegacyDb.user_savenotification( userId, true, autoWatchTopicsEnabled, YafContext.Current.Get<YafBoardSettings>().DefaultNotificationSetting, YafContext.Current.Get<YafBoardSettings>().DefaultSendDigestEmail); // save avatar if (twitterUser.ProfileImageUrl.IsSet()) { LegacyDb.user_saveavatar(userId, twitterUser.ProfileImageUrl, null, null); } LoginTwitterSuccess(true, oAuth, userId, user); message = YafContext.Current.Get<ILocalization>().GetText("LOGIN", "UPDATE_EMAIL"); return true; }
/// <summary> /// Gets the twitter user info as JSON string for the hover cards /// </summary> /// <param name="context">The context.</param> private void GetTwitterUserInfo([NotNull] HttpContext context) { try { var twitterName = context.Request.QueryString.GetFirstOrDefault("twitterinfo").ToType<string>(); if (!Config.IsTwitterEnabled) { context.Response.Write( "Error: Resource has been moved or is unavailable. Please contact the forum admin."); return; } var oAuth = new OAuthTwitter { ConsumerKey = Config.TwitterConsumerKey, ConsumerSecret = Config.TwitterConsumerSecret, Token = Config.TwitterToken, TokenSecret = Config.TwitterTokenSecret }; var tweetAPI = new TweetAPI(oAuth); context.Response.Write(tweetAPI.UsersLookupJson(twitterName)); HttpContext.Current.ApplicationInstance.CompleteRequest(); } catch (Exception x) { this.Get<ILogger>().Log(YafContext.Current.PageUserID, this, x, EventLogTypes.Information); context.Response.Write( "Error: Resource has been moved or is unavailable. Please contact the forum admin."); } }
/// <summary> /// Creates the or assign twitter user. /// </summary> /// <param name="twitterUser">The twitter user.</param> /// <param name="oAuth">The oAUTH.</param> /// <param name="message">The message.</param> /// <returns> /// Returns if the login was successfully or not /// </returns> private static bool CreateTwitterUser(TwitterUser twitterUser, OAuthTwitter oAuth, out string message) { if (YafContext.Current.Get <YafBoardSettings>().DisableRegistrations) { message = YafContext.Current.Get <ILocalization>().GetText("LOGIN", "SSO_FAILED"); return(false); } // Create User if not exists?! Doesnt work because there is no Email var email = "{0}@twitter.com".FormatWith(twitterUser.UserName); // Check user for bot /*var spamChecker = new YafSpamCheck(); * string result; * var isPossibleSpamBot = false; * * var userIpAddress = YafContext.Current.Get<HttpRequestBase>().GetUserRealIPAddress(); * * // Check content for spam * if (spamChecker.CheckUserForSpamBot(twitterUser.UserName, twitterUser.Email, userIpAddress, out result)) * { * YafContext.Current.Get<ILogger>().Log( * null, * "Bot Detected", * "Bot Check detected a possible SPAM BOT: (user name : '{0}', email : '{1}', ip: '{2}', reason : {3}), user was rejected." * .FormatWith(twitterUser.UserName, twitterUser.Email, userIpAddress, result), * EventLogTypes.SpamBotDetected); * * if (YafContext.Current.Get<YafBoardSettings>().BotHandlingOnRegister.Equals(1)) * { * // Flag user as spam bot * isPossibleSpamBot = true; * } * else if (YafContext.Current.Get<YafBoardSettings>().BotHandlingOnRegister.Equals(2)) * { * message = YafContext.Current.Get<ILocalization>().GetText("BOT_MESSAGE"); * * if (!YafContext.Current.Get<YafBoardSettings>().BanBotIpOnDetection) * { * return false; * } * * YafContext.Current.GetRepository<BannedIP>() * .Save( * null, * userIpAddress, * "A spam Bot who was trying to register was banned by IP {0}".FormatWith(userIpAddress), * YafContext.Current.PageUserID); * * // Clear cache * YafContext.Current.Get<IDataCache>().Remove(Constants.Cache.BannedIP); * * if (YafContext.Current.Get<YafBoardSettings>().LogBannedIP) * { * YafContext.Current.Get<ILogger>() * .Log( * null, * "IP BAN of Bot During Registration", * "A spam Bot who was trying to register was banned by IP {0}".FormatWith( * userIpAddress), * EventLogTypes.IpBanSet); * } * * return false; * } * }*/ // Create User if not exists?! MembershipCreateStatus status; var pass = Membership.GeneratePassword(32, 16); var securityAnswer = Membership.GeneratePassword(64, 30); MembershipUser user = YafContext.Current.Get <MembershipProvider>() .CreateUser( twitterUser.UserName, pass, email, "Answer is a generated Pass", securityAnswer, true, null, out status); // setup inital roles (if any) for this user RoleMembershipHelper.SetupUserRoles(YafContext.Current.PageBoardID, twitterUser.UserName); // create the user in the YAF DB as well as sync roles... int?userID = RoleMembershipHelper.CreateForumUser(user, YafContext.Current.PageBoardID); // create empty profile just so they have one YafUserProfile userProfile = YafUserProfile.GetProfile(twitterUser.UserName); userProfile.TwitterId = twitterUser.UserId.ToString(); userProfile.Twitter = twitterUser.UserName; userProfile.Homepage = twitterUser.Url.IsSet() ? twitterUser.Url : "http://twitter.com/{0}".FormatWith(twitterUser.UserName); userProfile.RealName = twitterUser.Name; userProfile.Interests = twitterUser.Description; userProfile.Location = twitterUser.Location; userProfile.Save(); // setup their inital profile information userProfile.Save(); if (userID == null) { // something is seriously wrong here -- redirect to failure... message = YafContext.Current.Get <ILocalization>().GetText("LOGIN", "SSO_TWITTER_FAILED"); return(false); } if (YafContext.Current.Get <YafBoardSettings>().NotificationOnUserRegisterEmailList.IsSet()) { // send user register notification to the following admin users... YafSingleSignOnUser.SendRegistrationNotificationEmail(user, userID.Value); } // save the time zone... int userId = UserMembershipHelper.GetUserIDFromProviderUserKey(user.ProviderUserKey); // send user register notification to the following admin users... SendRegistrationMessageToTwitterUser(user, pass, securityAnswer, userId, oAuth); LegacyDb.user_save( userId, YafContext.Current.PageBoardID, twitterUser.UserName, null, email, 0, null, null, null, null, null, null, null, null, null, null, null); bool autoWatchTopicsEnabled = YafContext.Current.Get <YafBoardSettings>().DefaultNotificationSetting == UserNotificationSetting.TopicsIPostToOrSubscribeTo; // save the settings... LegacyDb.user_savenotification( userId, true, autoWatchTopicsEnabled, YafContext.Current.Get <YafBoardSettings>().DefaultNotificationSetting, YafContext.Current.Get <YafBoardSettings>().DefaultSendDigestEmail); // save avatar if (twitterUser.ProfileImageUrl.IsSet()) { LegacyDb.user_saveavatar(userId, twitterUser.ProfileImageUrl, null, null); } LoginTwitterSuccess(true, oAuth, userId, user); message = YafContext.Current.Get <ILocalization>().GetText("LOGIN", "UPDATE_EMAIL"); return(true); }
/// <summary> /// Creates the or assign twitter user. /// </summary> /// <param name="twitterUser"> /// The twitter user. /// </param> /// <param name="oAuth"> /// The oAUTH. /// </param> /// <param name="message"> /// The message. /// </param> /// <returns> /// Returns if the login was successfully or not /// </returns> private static bool CreateTwitterUser(TwitterUser twitterUser, OAuthTwitter oAuth, out string message) { if (YafContext.Current.Get<YafBoardSettings>().DisableRegistrations) { message = YafContext.Current.Get<ILocalization>().GetText("LOGIN", "SSO_FAILED"); return false; } // Create User if not exists?! Doesn't work because there is no Email var email = "{0}@twitter.com".FormatWith(twitterUser.UserName); // Check user for bot /*var spamChecker = new YafSpamCheck(); string result; var isPossibleSpamBot = false; var userIpAddress = YafContext.Current.Get<HttpRequestBase>().GetUserRealIPAddress(); // Check content for spam if (spamChecker.CheckUserForSpamBot(twitterUser.UserName, twitterUser.Email, userIpAddress, out result)) { YafContext.Current.Get<ILogger>().Log( null, "Bot Detected", "Bot Check detected a possible SPAM BOT: (user name : '{0}', email : '{1}', ip: '{2}', reason : {3}), user was rejected." .FormatWith(twitterUser.UserName, twitterUser.Email, userIpAddress, result), EventLogTypes.SpamBotDetected); if (YafContext.Current.Get<YafBoardSettings>().BotHandlingOnRegister.Equals(1)) { // Flag user as spam bot isPossibleSpamBot = true; } else if (YafContext.Current.Get<YafBoardSettings>().BotHandlingOnRegister.Equals(2)) { message = YafContext.Current.Get<ILocalization>().GetText("BOT_MESSAGE"); if (!YafContext.Current.Get<YafBoardSettings>().BanBotIpOnDetection) { return false; } YafContext.Current.GetRepository<BannedIP>() .Save( null, userIpAddress, "A spam Bot who was trying to register was banned by IP {0}".FormatWith(userIpAddress), YafContext.Current.PageUserID); // Clear cache YafContext.Current.Get<IDataCache>().Remove(Constants.Cache.BannedIP); if (YafContext.Current.Get<YafBoardSettings>().LogBannedIP) { YafContext.Current.Get<ILogger>() .Log( null, "IP BAN of Bot During Registration", "A spam Bot who was trying to register was banned by IP {0}".FormatWith( userIpAddress), EventLogTypes.IpBanSet); } return false; } }*/ // Create User if not exists?! MembershipCreateStatus status; var memberShipProvider = YafContext.Current.Get<MembershipProvider>(); var pass = Membership.GeneratePassword(32, 16); var securityAnswer = Membership.GeneratePassword(64, 30); var user = memberShipProvider.CreateUser( twitterUser.UserName, pass, email, memberShipProvider.RequiresQuestionAndAnswer ? "Answer is a generated Pass" : null, memberShipProvider.RequiresQuestionAndAnswer ? securityAnswer : null, true, null, out status); // setup initial roles (if any) for this user RoleMembershipHelper.SetupUserRoles(YafContext.Current.PageBoardID, twitterUser.UserName); // create the user in the YAF DB as well as sync roles... int? userID = RoleMembershipHelper.CreateForumUser(user, YafContext.Current.PageBoardID); // create empty profile just so they have one YafUserProfile userProfile = YafUserProfile.GetProfile(twitterUser.UserName); userProfile.TwitterId = twitterUser.UserId.ToString(); userProfile.Twitter = twitterUser.UserName; userProfile.Homepage = twitterUser.Url.IsSet() ? twitterUser.Url : "http://twitter.com/{0}".FormatWith(twitterUser.UserName); userProfile.RealName = twitterUser.Name; userProfile.Interests = twitterUser.Description; userProfile.Location = twitterUser.Location; userProfile.Save(); // setup their initial profile information userProfile.Save(); if (userID == null) { // something is seriously wrong here -- redirect to failure... message = YafContext.Current.Get<ILocalization>().GetText("LOGIN", "SSO_TWITTER_FAILED"); return false; } if (YafContext.Current.Get<YafBoardSettings>().NotificationOnUserRegisterEmailList.IsSet()) { // send user register notification to the following admin users... YafContext.Current.Get<ISendNotification>().SendRegistrationNotificationEmail(user, userID.Value); } // save the time zone... var userId = UserMembershipHelper.GetUserIDFromProviderUserKey(user.ProviderUserKey); // send user register notification to the following admin users... SendRegistrationMessageToTwitterUser(user, pass, securityAnswer, userId, oAuth); LegacyDb.user_save( userId, YafContext.Current.PageBoardID, twitterUser.UserName, null, email, 0, null, null, null, null, null, null, null, null, null, null, null); var autoWatchTopicsEnabled = YafContext.Current.Get<YafBoardSettings>().DefaultNotificationSetting == UserNotificationSetting.TopicsIPostToOrSubscribeTo; // save the settings... LegacyDb.user_savenotification( userId, true, autoWatchTopicsEnabled, YafContext.Current.Get<YafBoardSettings>().DefaultNotificationSetting, YafContext.Current.Get<YafBoardSettings>().DefaultSendDigestEmail); // save avatar if (twitterUser.ProfileImageUrl.IsSet()) { LegacyDb.user_saveavatar(userId, twitterUser.ProfileImageUrl, null, null); } LoginTwitterSuccess(true, oAuth, userId, user); message = YafContext.Current.Get<ILocalization>().GetText("LOGIN", "UPDATE_EMAIL"); return true; }
/// <summary> /// Send an Private Message to the Newly Created User with /// his Account Info (Pass, Security Question and Answer) /// </summary> /// <param name="user"> /// The user. /// </param> /// <param name="pass"> /// The pass. /// </param> /// <param name="securityAnswer"> /// The security answer. /// </param> /// <param name="userId"> /// The user Id. /// </param> /// <param name="oAuth"> /// The oAUTH. /// </param> private static void SendRegistrationMessageToTwitterUser( [NotNull] MembershipUser user, [NotNull] string pass, [NotNull] string securityAnswer, [NotNull] int userId, OAuthTwitter oAuth) { var notifyUser = new YafTemplateEmail(); var subject = YafContext.Current.Get<ILocalization>() .GetText("COMMON", "NOTIFICATION_ON_NEW_FACEBOOK_USER_SUBJECT") .FormatWith(YafContext.Current.Get<YafBoardSettings>().Name); notifyUser.TemplateParams["{user}"] = user.UserName; notifyUser.TemplateParams["{email}"] = user.Email; notifyUser.TemplateParams["{pass}"] = pass; notifyUser.TemplateParams["{answer}"] = securityAnswer; notifyUser.TemplateParams["{forumname}"] = YafContext.Current.Get<YafBoardSettings>().Name; var emailBody = notifyUser.ProcessTemplate("NOTIFICATION_ON_TWITTER_REGISTER"); var messageFlags = new MessageFlags { IsHtml = false, IsBBCode = true }; // Send Message also as DM to Twitter. var tweetApi = new TweetAPI(oAuth); var message = "{0}. {1}".FormatWith( subject, YafContext.Current.Get<ILocalization>().GetText("LOGIN", "TWITTER_DM")); if (YafContext.Current.Get<YafBoardSettings>().AllowPrivateMessages) { LegacyDb.pmessage_save(2, userId, subject, emailBody, messageFlags.BitValue, -1); } else { message = YafContext.Current.Get<ILocalization>() .GetTextFormatted( "LOGIN", "TWITTER_DM_ACCOUNT", YafContext.Current.Get<YafBoardSettings>().Name, user.UserName, pass); } try { tweetApi.SendDirectMessage(TweetAPI.ResponseFormat.json, user.UserName, message.Truncate(140)); } catch (Exception ex) { YafContext.Current.Get<ILogger>().Error(ex, "Error while sending Twitter DM Message"); } }
/// <summary> /// Re-tweets Message thru the Twitter API /// </summary> /// <param name="sender"> /// The source of the event. /// </param> /// <param name="e"> /// The <see cref="System.EventArgs"/> instance containing the event data. /// </param> protected void Retweet_Click(object sender, EventArgs e) { var twitterName = this.Get<YafBoardSettings>().TwitterUserName.IsSet() ? "@{0} ".FormatWith(this.Get<YafBoardSettings>().TwitterUserName) : string.Empty; // process message... clean html, strip html, remove bbcode, etc... var twitterMsg = BBCodeHelper.StripBBCode( HtmlHelper.StripHtml(HtmlHelper.CleanHtmlString((string)this.DataRow["Message"]))).RemoveMultipleWhitespace(); var topicUrl = YafBuildLink.GetLinkNotEscaped(ForumPages.posts, true, "m={0}#post{0}", this.DataRow["MessageID"]); // Send Retweet Directlly thru the Twitter API if User is Twitter User if (Config.TwitterConsumerKey.IsSet() && Config.TwitterConsumerSecret.IsSet() && this.Get<IYafSession>().TwitterToken.IsSet() && this.Get<IYafSession>().TwitterTokenSecret.IsSet() && this.Get<IYafSession>().TwitterTokenSecret.IsSet() && this.PageContext.IsTwitterUser) { var oAuth = new OAuthTwitter { ConsumerKey = Config.TwitterConsumerKey, ConsumerSecret = Config.TwitterConsumerSecret, Token = this.Get<IYafSession>().TwitterToken, TokenSecret = this.Get<IYafSession>().TwitterTokenSecret }; var tweets = new TweetAPI(oAuth); tweets.UpdateStatus( TweetAPI.ResponseFormat.json, this.Server.UrlEncode("RT {1}: {0} {2}".FormatWith(twitterMsg.Truncate(100), twitterName, topicUrl)), string.Empty); } else { this.Get<HttpResponseBase>().Redirect( "http://twitter.com/share?url={0}&text={1}".FormatWith( this.Server.UrlEncode(topicUrl), this.Server.UrlEncode( "RT {1}: {0} {2}".FormatWith(twitterMsg.Truncate(100), twitterName, topicUrl)))); } }
/// <summary> /// Creates the or assign twitter user. /// </summary> /// <param name="twitterUser">The twitter user.</param> /// <param name="oAuth">The oAUTH.</param> /// <param name="message">The message.</param> /// <returns> /// Returns if the login was successfully or not /// </returns> private static bool CreateTwitterUser(TwitterUser twitterUser, OAuthTwitter oAuth, out string message) { if (YafContext.Current.Get <YafBoardSettings>().DisableRegistrations) { message = YafContext.Current.Get <ILocalization>().GetText("LOGIN", "SSO_FAILED"); return(false); } // Create User if not exists?! Doesnt work because there is no Email var email = "{0}@twitter.com".FormatWith(twitterUser.UserName); // Create User if not exists?! MembershipCreateStatus status; var pass = Membership.GeneratePassword(32, 16); var securityAnswer = Membership.GeneratePassword(64, 30); MembershipUser user = YafContext.Current.Get <MembershipProvider>() .CreateUser( twitterUser.UserName, pass, email, "Answer is a generated Pass", securityAnswer, true, null, out status); // setup inital roles (if any) for this user RoleMembershipHelper.SetupUserRoles(YafContext.Current.PageBoardID, twitterUser.UserName); // create the user in the YAF DB as well as sync roles... int?userID = RoleMembershipHelper.CreateForumUser(user, YafContext.Current.PageBoardID); // create empty profile just so they have one YafUserProfile userProfile = YafUserProfile.GetProfile(twitterUser.UserName); userProfile.TwitterId = twitterUser.UserId.ToString(); userProfile.Twitter = twitterUser.UserName; userProfile.Homepage = twitterUser.Url.IsSet() ? twitterUser.Url : "http://twitter.com/{0}".FormatWith(twitterUser.UserName); userProfile.RealName = twitterUser.Name; userProfile.Interests = twitterUser.Description; userProfile.Location = twitterUser.Location; userProfile.Save(); // setup their inital profile information userProfile.Save(); if (userID == null) { // something is seriously wrong here -- redirect to failure... message = YafContext.Current.Get <ILocalization>().GetText("LOGIN", "SSO_TWITTER_FAILED"); return(false); } if (YafContext.Current.Get <YafBoardSettings>().NotificationOnUserRegisterEmailList.IsSet()) { // send user register notification to the following admin users... YafSingleSignOnUser.SendRegistrationNotificationEmail(user); } // save the time zone... int userId = UserMembershipHelper.GetUserIDFromProviderUserKey(user.ProviderUserKey); // send user register notification to the following admin users... SendRegistrationMessageToTwitterUser(user, pass, securityAnswer, userId, oAuth); LegacyDb.user_save( userId, YafContext.Current.PageBoardID, twitterUser.UserName, null, email, 0, null, null, null, null, null, null, null, null, null, null, null); bool autoWatchTopicsEnabled = YafContext.Current.Get <YafBoardSettings>().DefaultNotificationSetting == UserNotificationSetting.TopicsIPostToOrSubscribeTo; // save the settings... LegacyDb.user_savenotification( userId, true, autoWatchTopicsEnabled, YafContext.Current.Get <YafBoardSettings>().DefaultNotificationSetting, YafContext.Current.Get <YafBoardSettings>().DefaultSendDigestEmail); // save avatar if (twitterUser.ProfileImageUrl.IsSet()) { LegacyDb.user_saveavatar(userId, twitterUser.ProfileImageUrl, null, null); } LoginTwitterSuccess(true, oAuth, userId, user); message = YafContext.Current.Get <ILocalization>().GetText("LOGIN", "UPDATE_EMAIL"); return(true); }