w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
python-requests - can't login
There are lots of options, but I have had success using cookielib instead of trying to "manually" handle the cookies. import urllib2 import cookielib cookiejar = cookielib.CookieJar() cookiejar.clear() urlOpener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookiejar)) # ...etc... Some potentially relevant answers on getting this set up are on SO, including: http://stackoverflow.com/a/5826033/1681480

Categories : Python

Login and upload file using Python 'requests'
Make a session and then use that session to do your requests - sessionObj = requests.session() sessionOj.get(...) # Do whatever ... A session persists your cookies for future requests. And use post parameters for username,password as the parameters are required to login in login.php , not auth username password. Also use files parameter to upload files. So the final code is - import requests sessionObj = requests.session() url1='http://www.abc.com/login.php' r = sessionObj.post(url1, params={'username':'usernamehere' , 'password':'password here'}) print r.status_code //msg:'200' filehandle = open('./tmp.txt') url2='http://www.abc.com/uploader.php' r = sessionObj.post(url2, data={},files = {'upload':filehandle}) print r.text Docs.

Categories : Python

Using python requests library to login to website
@DanAlbert pointed out that I was telling you to use HTTP Auth which isn't what you're trying to do. I assumed since everything looked correct that it might just be HTTP Auth that you needed. However, looking at the form it looks like maybe you're just using the wrong variable name in your dict: import requests s = requests.session() login_data = dict(email='email', password='password') s.post('https://account.guildwars2.com/login', data=login_data) r = s.get('https://leaderboards.guildwars2.com/en/na/achievements/guild/Darkhaven%20Elite') print r.content If you look at the form it's expecting the variables "email" and "password". You have "username" and "password" Anyway, HTH

Categories : Python

Unable to login to a website using python script as I am behind a proxy which needs authentication
Add a proxy handler: opener = urllib.request.build_opener( urllib.request.ProxyHandler({'http': r'http://username:password@url:port'}), urllib.request.HTTPRedirectHandler(), urllib.request.HTTPHandler(debuglevel=0), urllib.request.HTTPSHandler(debuglevel=0), urllib.request.HTTPCookieProcessor(cookies) )

Categories : Python

Trouble Connecting to sql server Login failed. "The login is from an untrusted domain and cannot be used with Windows authentication"
Why not use a SQL Server account and pass both the user name and password? Here is the reason why. In short, it looks like you have an authentication issue. The problem with workgroups is there is no common Access Control List like Active Directory (AD). If you are using ODBC or JDBC, the wrong credentials are passed. Even if you create a local windows account (LWA) on the machine (SE) that has SQL Express installed (SELWA), the credentials that will be passed from your client machine (CM) will be CMLWA.

Categories : Sql Server

How to limit download rate of HTTP requests in requests python library?
There are several approaches to rate limiting; one of them is token bucket, for which you can find a recipe here and another one here. Usually you would want to do throttling or rate limiting on socket.send() and socket.recv(). You could play with socket-throttle and see if it does what you need. This is not to be confused with x-ratelimit rate limiting response headers, which are related to a number of requests rather than a download / transfer rate.

Categories : Python

python-requests returning unicode Exception message (or how to set requests locale)
You can try os.strerror, but it would probably return nothing or the same non-English string. This hard-coded English was scraped from here: http://support.microsoft.com/kb/819124 ENGLISH_WINDOWS_SOCKET_MESSAGES = { 10004: "Interrupted function call.", 10013: "Permission denied.", 10014: "Bad address.", 10022: "Invalid argument.", 10024: "Too many open files.", 10035: "Resource temporarily unavailable.", 10036: "Operation now in progress.", 10037: "Operation already in progress.", 10038: "Socket operation on nonsocket.", 10039: "Destination address required.", 10040: "Message too long.", 10041: "Protocol wrong type for socket.", 10042: "Bad protocol option.", 10043: "Protocol not supported.", 10044: "Socket type not supported.",

Categories : Python

Consecutive requests with python Requests.Session() not working
In the lastest version of requests, he sessions object is with Cookie Persistence, look the requests Sessions ojbects docs. So you don't need add the cookie artificialy. Just import requests s=requests.Session() login_data = dict(userName='user', password='pwd') ra=s.post('http://example/checklogin.php', data=login_data) print ra.content print ra.headers ans = dict(answer='5') r=s.post('http://example/level1.php',data=ans) print r.content Just print the cookie to look up wheather you were logged. for cookie in s.cookies: print (cookie.name, cookie.value) And is the example site is yours? If not maybe the site reject the bot/crawler ! And you can change your requests's user-agent as looks likes you are using a browser. For example: import requests s=requests.Session() headers

Categories : Python

Simple Android authentication and requests after it
You pretty much have it summed up I guess. Let the app send the credentials with a POST, the server checks if they are okay, then sends back a token (some random String maybe). When you make the GET requests after login, send the token with a custom HTTP header and let the server check it. The server has a list of valid tokens and checks if the received token is valid. If not, it responds with an error message, else it does what it's supposed to do. That's all very basic and not at all secure of course. Edit: The GET request could be done like this: HttpClient client = new DefaultHttpClient(); HttpGet get = new HttpGet("someUrl.com/rest"); get.setHeader("Authorization", "someTokenYouCreated"); HttpResponse response = client.execute(get); You'll find lot's of examples about c

Categories : Java

Java: Download file from URL when URL requests authentication
If the server uses BASIC authentication, you should be able to get the resource by specifying username/password in the URL: http://user:password@hostname/path/filename.ext Browsers support this too, so you can try it in your browser quickly.

Categories : Java

mod_auth_cas redirects random requests to CAS login
We have just had the same problem. The solution is simple: Configure Apache to use MPM Prefork. The problem happens when Apache is configured to use MPM Worker. When many requests arrive simultaneously (i.e. 20 requests), some of them are randomly redirected to the SSO server.

Categories : Javascript

login authentication using httpget from url
You can possibly check two states of this request HTTP response code Check if data returned with ´HTTP 200 OK´ Data check Deserialize response (SimpleXML, Jackson Json or FasterXML project) Check for deserialization status (if the model changed or response is empty, it would probably fail) Match fields in deserialized object to your conditions

Categories : PHP

Two login pages in authentication in ASP.Net MVC 4
Like Nanda suggested - if both login pages are using the same type of authentication then it might be worth looking at your design as this doesn't sound right. But if you want to use a two different methods of authentication in your app then you can create a separate Area in your MVC project to achieve this.

Categories : Asp Net Mvc

Still requiring login after SSH authentication
Good that you have correctly setup your git ssh now you need to reclone the git repository with ssh for example previously you would have done something like this : git clone https://github.com/dangrossman/bootstrap-daterangepicker.git this was a https clone now you need to clone with ssh as git clone git@github.com:dangrossman/bootstrap-daterangepicker.git you can find the ssh link from your github account same place where you found your https link. After this you can easily push without your password prompt . It might though ask for your ssh unlock password. You then need to enter the paraphase you gave during the creation of your ssh key . If you left it blank it might not prompt for it .

Categories : Github

authentication, cant go through login page
one of the conventions in rails is, that public methods in a controller are considered to be actions. if you want to write methods for before_filter etc, make them private or protected so that rails will not expose them as actions. on the flipside, you are not able to define actions as private.

Categories : Ruby On Rails

User authentication does login without authenticating
I think you don't login but redirect to index action and you think login beacuse your loginRedirect option is index action and you allow this action in beforeFilter $this->Auth->allow('index','view'); please add: debug($this->Auth->login()); debug($this->request->data); die(); before: if ($this->Auth->login()) { if($this->Auth->login()); $this->redirect($this->Auth->redirect()); } else { $this->Session->setFlash(__('Invalid username or password, try again')); } result of debug($this->Auth->login()); should be false if you enter wrong user or password

Categories : Cakephp

Twitter Login Authentication in ASP.NET: 410 Error
You probably need to change the URL in your code to use the 1.1 version of the API since the 1.0 version of the API is dead. url = "http://api.twitter.com/1.1/account/verify_credentials.xml"; ^^ -- this

Categories : C#

Using created Login Page for authentication in ASP.NET MVC 4
In ASP.NET MVC, your URLs don't map to files; they map to actions. So, having a file at ~/Accounts/PasswordLock.aspx doesn't help. What you need is a route for that URL. The routes are usually set up in a file called RouteConfig, under the App_Start folder, executed by the Application_Start() method in Global.asax. The usual default route looks like this: routes.MapRoute( name: "default", routeTemplate: "{controller}/{action}/{id}", defaults: new { id = RouteParameter.Optional }); This means that a URL that goes www.example.com/Accounts/PasswordLock will map to a controller called AccountsController, and a method on that controller called PasswordLock. This method should return a View which by default will be called PasswordLock.cshtml. Note that the new Razor v2 view engine

Categories : Asp Net Mvc

'Login as another user' MVC 4 Windows Authentication
People reverse engineereddecompiled some code from Sharepoint that happens to have this feature. I tested it in an ASP.NET MVC 5 app and it's working as expected. The code is based on decompiling the Microsoft.TeamFoundation.WebAccess which has the "Sign in as a different User" function. public ActionResult LogOut() { HttpCookie cookie = Request.Cookies["TSWA-Last-User"]; if(User.Identity.IsAuthenticated == false || cookie == null || StringComparer.OrdinalIgnoreCase.Equals(User.Identity.Name, cookie.Value)) { string name = string.Empty; if(Request.IsAuthenticated) { name = User.Identity.Name; } cookie = new HttpCookie("TSWA-Last-User", name); Response.Cookies.Set(cookie); Response.AppendHeader("C

Categories : Asp Net Mvc

Error with my Login Authentication Servlet
I would look into Spring, and Spring Security, Spring offers good tested system to secure website and manage db connections. Currently it supports DB-backed, JNDI-backed security or you can just hardcode users and roles. With spring you can secure just sections of the site or methods Here is more info about security itself http://static.springsource.org/spring-security/site/tutorial.html

Categories : Java

Use other table than user for login authentication
In your registration page insert your password using HASH. Write the code as public function post_register() { $input = Input::all(); $rules = array( 'email' => 'required|email|Between:3, 64|unique:student,username', 'studentPass' => 'required', 'studentName' => 'required', 'studentAge' => 'integer|Min:18|Max:45'); $messages = array( 'email.required' => 'You forgot to enter your email id!', 'email.between' => 'Email must be between 3 to 64 character!', 'studentPass.required' => 'You forgot to enter your password!', 'studentName.required' => 'You forgot to enter student name!', 'studentAge.integer' => 'Student age must be a integer value!', 'studentAge.min' => 'St

Categories : Mysql

login authentication script error
You code appears to be okay When you enter a new record, make sure you don't enter the plain password string, you should enter the md5 hash value of the password since your code looks for the hash value and not the original string.

Categories : PHP

Facebook authentication without login button
Something like this private void performFacebookLogin() { Log.d("FACEBOOK", "performFacebookLogin"); final Session.NewPermissionsRequest newPermissionsRequest = new Session.NewPermissionsRequest(this, Arrays.asList("email")); Session openActiveSession = Session.openActiveSession(this, true, new Session.StatusCallback() { @Override public void call(Session session, SessionState state, Exception exception) { Log.d("FACEBOOK", "call"); if (session.isOpened() && !isFetching) { Log.d("FACEBOOK", "if (session.isOpened() && !isFetching)"); isFetching = true; session.requestNewReadPermissions(newPermissionsRequest); Request getMe = Request.new

Categories : Android

Login authentication fails in laravel 4
You should hash your password. array( 'username' => 'admin', 'password' => Hash::make('password') ), You can find more information in the docs.

Categories : PHP

I have a trouble with my Login Authentication Servlet
I guess the loganto is the boolean flag indicating that a user is logged in or not. The problem in your code is that you execute the Select query but you never check if a record was found. You can do it like this: ResultSet rs=stmt.executeQuery(); while(rs.next()){ loganto=true; //a valid record was found so return true } rs.close(); return loganto;

Categories : Java

Devise : How to redirect to login page after user requests new confirmation himself?
You set this path with the following code inside your confirmations_controller: def after_resending_confirmation_instructions_path_for login_path # or whatever you want end However, the default is to redirect to new_session_path(resource_name) which does exactly what you want and so it does for my app. Maybe it depends on the version of devise.

Categories : Ruby On Rails

Perl: How can i test for a URL ( https ) accepting GET requests using "login" parameter
Sending password in a cookie? Nope. Disallow GET for /login. POST username and password to /login, over SSL. In CGI, the GET/POST is indicated via the REQUEST_METHOD environment variable. You cannot stop determined people from issuing a GET request to your server, but you can refuse to process it like so (untested code - you have to fill in details): if ($ENV{REQUEST_METHOD} ne 'POST') { # issue a redirect to a suitable error page, then return. } my $q = CGI->new(); my $user = $q->params('username'); my $password = $q->params('password'); my $encrypted_password = my_password_encryptor($password); unless ( can_log_in($user, $encrypted_password) ) { # issue an error message - redirect&return or fall-through... } else { $session->set_user_

Categories : Perl

authentication forms login url and route data
Unfortunately, you cannot simply set a value in loginUrl that will change to the current culture. I have a site where I have the culture in the URL and specify the loginUrl. What I do is that in each request, I ensure that the culture is specified in the URL, if it is not, I simply redirect the user by prepending the culture to the current requested URL. Therefore, /en-us/controller/memberonly -> /account/login -> /en-us/account/login

Categories : C#

Authentication cookie is not passed after login using IE10
Still cannot post comments... You can always use cookieless="AutoDetect" to use Uri instead of cookies if it cannot set cookie. Some user may even deny all cookies, that is why all advertisements use only Uri mode. Though it might result in share of Uri (easier than to share cookies) and if a user shouldn't be allowed to login from different places at once you'll need to revise your login logic.

Categories : Asp Net

Extra login field for Devise authentication
I would simple generate the views: bundle exec rails generate devise:views This will copy the devise views into your app/views folder. After that you can modify the app/views/devise/sessions/new.html.erb file and extend it with your form fields. After that you can overwrite the devise controller.

Categories : Ruby On Rails

Ajax Django Login/Authentication without re-direct
So, it looks like your current problem is with this: alert (json.server_response);. You may want to look into changing your $.ajax dataType parameter to json. To quote the docs: The type of data that you're expecting back from the server. If none is specified, jQuery will try to infer it based on the MIME type of the response (an XML MIME type will yield XML, in 1.4 JSON will yield a JavaScript object, in 1.4 script will execute the script, and anything else will be returned as a string). The available types (and the result passed as the first argument to your success callback) are:... "html": Returns HTML as plain text; included script tags are evaluated when inserted in the DOM. "json": Evaluates the response as JSON and returns a JavaScript object. The JSON data is parse

Categories : Ajax

Login Authentication using Active Directory in the Intranet...Possible?
Check this Post It uses Active Directory to authenticate site members on Intranet.

Categories : C#

Authentication to dropbox (login/passwd) with libcurl under c++
I suggest that you should first make clear how to auth dropbox in firefox or chrome with debugger tools, it is not so easy to figure it out when facing obfuscated javscript codes, so you'd better first check if dropbox has openapi for developer.

Categories : C++

Authentication using Tomcat realm or Facebook login
One option could be to use a Combined Realm: See http://tomcat.apache.org/tomcat-7.0-doc/realm-howto.html#CombinedRealm Realm 1 should be JDBCRealm, then implement realm 2 (FacebookRealm). You might change the order, based on which one is the most frequently used. See Tomcat docs for how to implement a realm. Of course you don't have a password in FacebookRealm, but you could do the following trick: JDBCRealm: username = username/userId in your application password = password FacebookRealm: username = username/userId in your application password = unique user id provided by Facebook This could allow users to log in with whatever method they want. Basically, this could be a possible use case for logging in through FacebookRealm (first steps might be a little bit different with JS SDK, b

Categories : Facebook

python login to website, no "id" only "class" for login button
Use session. Or cookies are not kept. import requests s = requests.session() # <-- url = 'http://company.page.com/member/index.php' values = {'username': 'myusernamehere', 'password': 'mypasswordhere'} r = s.post(url, data=values) # session.post instead of requests.post # Now you have logged in url = "http://company.page.com/member/member.php" (this is the resulting url after logging in) result = s.get(url) # Use session.get and do not specify cookies. print (result.headers) print (result.text)

Categories : Python

Stored Procedure for Login Authentication not working MySQL
You definitely don't need CURSORs for that; use plain simple SELECT. A more concise version of your SP might look like DELIMITER $$ CREATE DEFINER = `FreeUser`@`localhost` PROCEDURE `acl`.`checkAuthenticationTwo` ( IN iUsername VARCHAR(50), IN iPassword VARCHAR(50), OUT oMessage VARCHAR(50), OUT oUserID INT ) BEGIN SELECT CASE WHEN IsActive = 0 THEN 'Inactive account' ELSE 'Success' END, CASE WHEN IsActive = 0 THEN NULL ELSE UserID END INTO oMessage, oUserID FROM m_users WHERE (LoginName = TRIM(iUsername) OR Email = TRIM(iUsername)) AND `Password` = iPassword LIMIT 1; -- you better protect yourself from duplicates SET oMessage = IFNULL(oMessage, 'Invalid username and password'); END$$ DELIMITER ; What it does

Categories : Mysql

How to handle error when login with different domain in windows authentication?
In IIS, make sure anonymous access is not selected, only integrated windows authentication needs to be selected. Also I assume you mentioned authentication and authorization tags under <system.web> section.

Categories : C#

Java/Scala library for user login and authentication
Well the easiest and the fastest way of doing it would be using Play. Crash course: In routes, declare as POST /login controller.Dashboard.regis And then object Dashboard extends Controller{ val loginForm = Form( tuple( "name" -> text, "email" -> text, "pass" -> text)) def regis = Action { implicit request => val form = loginForm.bindFromRequest form.fold( formWithErrors => BadRequest("bad reqeust "+formWithErrors), user => { val input = CreateUser(user._1, user._2, user._3) Try(Users.addUser(input)) match { case Failure(err) => InternalServerError(err.getMessage()) case Success(x) => //so on } I have not used but they say even Scalantra is pre

Categories : Java

How to deal with 2-step authentication for Facebook on Spotify login?
I think if you try to login 3 or 4 times, then facebook very helpfully gives you an "account alert" on their website and lets you verify that you were actually trying to login and then it should work. I'm not sure about the better way to do this. Two factor auth still trips up even many of google's login mechanisms that don't even involve oauth.

Categories : IOS

Django lockdown authentication - Login form not working
Your lockdown password should be a tuple. Something like LOCKDOWN_PASSWORDS = ('letmein', 'beta'). Also you should not be writing a template to get it working. Django-lockdown is batteries included. Just out of the box (this and only this): pip install django-lockdown, add 'lockdown', (with trailing comma) to APPS, add 'lockdown.middleware.LockdownMiddleware', (with trailing comma) to the middleware, add LOCKDOWN_PASSWORDS = ('letmein', 'beta') [all these things in settings]

Categories : Django



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.