Jump to content

Obi1-Cannabis

Members
  • Posts

    146
  • Joined

  • Last visited

Posts posted by Obi1-Cannabis

  1. Is it possible to extend the OAuthGrantResourceOwnerCredentialsContext class from Microsoft.Owin.Security.OAuth?

    when implementing my custom OAuthProvider I want to be able to add a new IList to the context in order to send messages that will be intercepted by Growl in AngularJs. what i want to do in case of an error for example is something like:

    public class CustomOAuthProvider : OAuthAuthorizationServerProviderExtended{    //removed code for brevity    public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContextExtended context)    {       //removed code for brevity       ApplicationUser user = await userManager.FindAsync(context.UserName, context.Password);       if (user == null)       {           context.messages.Add(GeneralEx.CreateGrowlMessage("The company, user name or password is incorrect.", "error"));           return;       }       //removed code for brevity   }}

    where CreateGrowlMessage is

    public static GrowlMessage CreateGrowlMessage(string message, string severity)    {        GrowlMessage growlMessage = new GrowlMessage();        growlMessage.text = message;        growlMessage.severity = severity;        return growlMessage;    }

    and GrowlMessage is

    public class GrowlMessage{    public string text;    public string severity;}

    I was trying to extend both OAuthAuthorizationServerProvider and OAuthGrantResourceOwnerCredentialsContext shown bellow

    public class OAuthAuthorizationServerProviderExtended : OAuthAuthorizationServerProvider    {        public virtual Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContextExtended context)        {            return Task.FromResult<object>(null);        }    }    public class OAuthGrantResourceOwnerCredentialsContextExtended : OAuthGrantResourceOwnerCredentialsContext    {        public OAuthGrantResourceOwnerCredentialsContextExtended(IOwinContext context, OAuthAuthorizationServerOptions options, string clientId, string userName, string password, IList<string> scope)            : base(context, options, clientId, userName, password, scope)        {        }        public IList<GrowlMessage> messages {get;set;}    }

    but this is not having the desired effect. now all login attempts fail and all i get in the response is {"error":"invalid_grant"}

  2. I'm having trouble sending emails from an email like "mail@domain.com" wich is configured to use the live.mail.com client. Even though i think i'm using the right credentials i get the following error:

    "Mailbox unavailable. The server response was: 5.7.3 Requested action aborted; user not authenticated"

    this are my configurations:

    smtpClient = new SmtpClient("smtp.live.com");smtpClient.Port = 587;smtpClient.UseDefaultCredentials = false;smtpClient.Credentials = new System.Net.NetworkCredential("mail@domain.com", "Password");smtpClient.EnableSsl = true;

    any help is appreciated, for I can't seem to work-arround this problem and have to have this website online ASAP

     

  3. setting animation-fill-mode: forwards means that after the animation has completed execution i will hold at its final properties until the animation is removed.

     

    i guess i don't really understand what you are trying to acomplish.

  4. I say there's space for a lot of improvement here,

     

    • the page looks overwhelmed even though there isn't that much information, you should make use of more clear space.
    • the backgrounds should be more smooth to give it a more appealing to the eye feeling.
    • also a more readable frendly font would be good

    this just for starters take a look at the Web Design Concepts section of this page http://www.w3.org/community/webed/wiki/Main_Page#Web_Design_Concepts study it and try to improve your overall design.

  5. You'll need to use -webkit-animation-fill-mode

    -webkit-animation-fill-mode: forwards;

    leaves the animation in the last frame

    -webkit-animation-fill-mode: backwards;

    leaves the animation in the start frame

  6. I'm trying to figure this out for a few day now, i have custom membership and role providers for my project and it works perfectly on my dev machine, but on production it throws the following error for the web.config

     

    Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

    Parser Error Message: Exception has been thrown by the target of an invocation.

    Source Error:

    Line 24: <providers>Line 25: <clear />Line 26: <add name="FeelSafeRoleProvider" type="FeelSafe.Helpers.FeelSafeRoleProvider, FeelSafe" connectionStringName="FeelSafeEntities" />Line 27: </providers>Line 28: </roleManager>

    Source File: (...)web.config Line: 26

     

     

    I've read about people having simmilar issues because they hadn't named their connectionstrings but that's not the case here...

    any toughts on what's going on here?

     

    if you need any more info just ask and i'll provide.

     

    thanks for any help

  7. I've already made my custom MemberShipProvider but now i would like to associate it with UserProfile using my specific fields. The problem is i can't find any good tutorial or article on how to do this...can anyone guide me in the right direction?by the way i'm a newbie to ASP.NET MVC3 and am using C#Edit: ok nevermind, i found what i was looking for.

  8. no, you should not store any password on the session and if you want it only for admin you shoud have something to differentiate the admin from other users - a column isadmin(bit) set to 1 if the user is an administrator and to 0 if it's not.then when your user logs in you have to had that info to the session to.your $_SESSION["user"] would be something like

    $_SESSION["user"] = array("login"=>true,"username"=>"loged_user_name", "isadmin"=>true);

    when the user is an administrator, and then your code to show the edit link will be

    <?php...your code...if(isset($_SESSION["user"]["login"]) && $_SESSION["user"]["login"] == true && isset($_SESSION["user"]["isadmin"]) && $_SESSION["user"]["isadmin"] == true ){?>	<a href="your_link">Edit</a><?php}...continue code...?>

  9. having $_SESSION["user"]["login"] whith default value being false when not logged-in then when a user logs-in you give this session var the value of true

    <?php...your code...if(isset($_SESSION["user"]["login"]) && $_SESSION["user"]["login"] == true){?>	<a href="your_link">Edit</a><?php}...continue code...?>

  10. There are two types of UTF-8: UTF-8 with BOM (Byte Order Mark) and UTF-8 on its own.If the UTF-8 has a BOM it sometimes may be interpretted has having a couple of characters as the beginning of the file, so you should make sure your editor saves the file without a BOM.
    ok thanks for clarification :)
    Timeout usually occurs if you have an infinite loop.
    yes, but how come session_start() be considerided as an infinite loop? i'm prety sure it can't
  11. yeah!there was no blank lines, however re-saving the file explicitly as utf-8 seems to have solved this one, though this had never happened to me before and never heard about this, why does it happen?and what about the timeout? any toughts?

  12. hi, this is kind of weird and is driving me crazy i'm finding at my php_error_log.txt that sometimes there are one of this two errors when calling session_start()sometimes everything is ok, other times i get a Maximum execution time of 30 seconds exceeded in <SERVER>\app.php on line 13 and some other times i get this:

    session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cache limiter - headers already sent (output started at <SERVER>\www\cesto\index.php:1) in <SERVER>\app.php on line 13
    but this doesn't seem possible since all my code until the session_start is:
    <?php	/*error_reporting(E_ALL);	ini_set('display_errors', '1');*/	//configuracao do header p3p privacy	header('P3P:CP="CAO DSP COR CURa ADMa DEVa OUR IND PHY ONL UNI COM NAV INT"');		/*header("Cache-Control: no-cache, must-revalidate");	header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");*/		//Configuracoes de Sessao	session_cache_limiter('none');	session_start();

    does anyone have any idea why this might be happening?

  13. yep, use regex to to validate that is numeric.but i would prefer to do do something to prevent the user from even trying to insert anything else, doing something like:

    $(document).ready(   function()   {	  $("#zipcode").keydown(function(event) {	// Allow backspace and delete	if ( event.keyCode == 46 || event.keyCode == 8 ) {	   	}	else {	   // Ensure that it is a number	   if (event.keyCode < 48 || event.keyCode > 57 ) {		event.preventDefault();		   }		}   });});

  14. if you just want to check the length, assuming your input field id is zipcode

    function ValidateInput(){   var error = '';   if($('#zipcode).val().length < 6)   {	  error += 'zip code must have 6 digits';   }   /*Do here other validations*/   if(error.length >= 1)   {	  alert(error);	  return false;   }   else   {	  return true;   }}

    if you also want to validate the format use regular expression, i'am not familiar with U.S. zip code if thats what you're looking for.also if you really want to use only jquery, try checking this jquery validation plugin and the method specified in that website.

  15. Hi, i'm not sure if theis would be the right place to put this, since i've made a few searches on the forum and found nothing on the facebook sdk or plugins subject.Anyway, i hope someone can help me.I'm having this issue for a while now.My login-button is not working correctly on IE (9 version at least), though it works fine on firefox, chrome, opera, safari.First time a user clicks the link it opens the window to allow the permitions and then it gets stuck http://static.ak.fbcdn.net/connect/:)_proxy.php?...Every other time you click the button it just goes to that same page and gets stucked.The integrated login to my page itself never gets performed.There's no error, no warning, no message, no nothing.I already saw a bunch of solutions arround the web that seems to have worked for others but none of them solved my problem.here is part of my code, where the button and fb connection gets called and what to do when loging in through facebook button:

    (...)<body>   <div id="fb-root"></div>   (...)   <div id="facebookConnect"></div>   (...)   <script type="text/javascript">	  $(document).ready(		 function()		 {			var loginContent = '<fb:login-button perms="user_birthday,user_location,email" show-faces="false" width="200" max-rows="1"></fb:login-button>';			$("#facebookConnect").html(loginContent);			window.fbAsyncInit = function()			{			   FB.init( 				  {					 appId   : facebookAppId,					 session : facebookSession, // don't refetch the session when PHP already has it					 status  : true, // check login status					 cookie  : true, // enable cookies to allow the server to access the session					 xfbml   : true // parse XFBML				  }			   );			   FB.Event.subscribe('auth.login', function() 				  {					 $.getJSON("http://myinc/ajax/loginFacebook.php?callback=?",						{},						function(json, status)						{						   if(json.sucesso == true)						   {							  (...)						   }						}					   );				   }				);			}			var e = document.createElement('script');			e.src = document.location.protocol + '//connect.facebook.net/pt_PT/all.js#xfbml=1"';			e.async = true;			document.getElementById('fb-root').appendChild(e);		 }	  );   </script>(...)

    any help anyone can give with this is much apreciated!

×
×
  • Create New...