protected override ApiResultMessage HandleRequest(object args) { var data = ((JObject)args).ToObject <ApiAuthenticationData>(); Member user = null; if (!data.isFacebook) { //Standard login procedure TitanAuthService.Login(data.username, data.password, data.secondaryPassword, false); user = new Member(data.username); } else { //Facebook login procedure FacebookMember fbUser = new FacebookMember(data.username); TitanAuthService.LoginOrRegister(fbUser, false); user = TableHelper.SelectRows <Member>(TableHelper.MakeDictionary("FacebookOAuthId", fbUser.FacebookId))[0]; } var token = ApiAccessToken.GetOrCreate(user.Id); return(new ApiResultMessage { success = true, message = String.Empty, data = new JObject(new JProperty("token", token.Token)) }); }
protected void LoginButton_Click(object sender, EventArgs e) { if (Page.IsValid) { try { TitanAuthService.Login(Username.Text, Password.Text, Password2.Text); } catch (SpecialException ex) { //Account inctive if (ReactivationEnabled) { ReactivateButton.Visible = true; LoginButton.Visible = false; } FailureP.Visible = true; FailureText.Text = ex.Message; FormsAuthentication.SignOut(); } catch (MsgException ex) { FailureP.Visible = true; FailureText.Text = ex.Message; FormsAuthentication.SignOut(); if (ex.Message == L1.ACCNOTACTIVATED) { FailureText.Text += " " + U6006.CLICKBUTTONBELOW; ShowResendActivationControls(); } } catch (Exception ex) { ErrorLogger.Log(ex); throw ex; } } }