w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Using email instead of username in CakePHP Auth Component
You can configure it with: public $components = array( 'Auth' => array( 'authenticate' => array( 'Form' => array( 'fields' => array('username' => 'email') ) ) ) ); See also Configuring Authentication handlers in the cookbook.

Categories : Cakephp

Does Windows Azure ACS support username / password auth?
You can authenticate directly with the ACS by using Service Identities, but they are not intended to be used for end-user authentication, as the page explains: Service identities are not intended to be used as end-user credentials. In ACS, service identities are most commonly used in REST web service scenarios, over the OAuth WRAP protocol, where a client requests a SWT token directly from ACS to present to the web service. I believe this is the only way to directly get a token from the ACS.

Categories : Azure

Passing basic auth username to a shell script
If you have PHP, this info is available in the $_SERVER superglobal, so you can just do: file_put_contents('/path/to/log/file', $_SERVER['REMOTE_USER'] . " ", FILE_APPEND);

Categories : Http

CakePHP - Set up Auth model to only use one password field, no username
You can build your very own custom authorize object which can use whatever you like. In this class you would do your lookup using one field and return true / false if the user is allowed access.

Categories : Cakephp

CakePHP login by Username Or Email using Auth component
You can leverage the MultipleColumn Auth adapter: https://github.com/ceeram/Authenticate/blob/master/Controller/Component/Auth/MultiColumnAuthenticate.php

Categories : Cakephp

Why does the stock auth Login view require a username field value when I’m using a custom user model?
Right, got it. I wrote my login form HTML myself (rather than rendering it using Django’s form template tags), and my e-mail field looked like this: <input id="loginForm_email" name="email" type="email" placeholder="Your e-mail adddress"> I believe the stock auth login view requires the username-equivalent field to actually be called username, like this: <input id="loginForm_email" name="username" type="email" placeholder="Your e-mail adddress"> Once I made that change, it worked fine.

Categories : Django

Function read argument or stdin
warn () { ( if [ $# -gt 0 ] then exec <<< $1 fi awk '{printf "33[36m%s33[m ", $0}' ) } The exec command allows you to perform a redirection that persists to following commands.

Categories : Bash

Best way to read stdin that may include newline?
If you are simply reading blocks of information without the need for scanf(), then fread() may be what you are after. But on consoles you can read to the , notice the , then continue reading more if you decide that is not for you.

Categories : C

How to read stdin from pipes in an R script?
Here is an example I use on the webpage for littler and which you should be able to adapt for Rscript too: The code of the script is just: #!/usr/bin/r -i fsizes <- as.integer(readLines(file("stdin"))) print(summary(fsizes)) stem(fsizes) and I feed the result from ls -l into, filtered by awk to get just one column of file sizes: edd@max:~/svn/littler/examples$ ls -l /bin/ | awk '{print $5}' | ./fsizes.r Min. 1st Qu. Median Mean 3rd Qu. Max. NA's 3 6240 30820 61810 60170 2000000 1 The decimal point is 5 digit(s) to the right of the | 0 | 00000000000000000000000000000000000111111111111111111111111122222222+57 1 | 111112222345679 2 | 7 3 | 1 4 | 1 5 | 6 | 7 | 8 | 9 | 6 10 | 11 | 12 | 13 | 14 |

Categories : R

How do I connect to Facebook chat using Username/Password auth option and successfully send a message in either Javascript or Ruby?
From the Facebook API Docs: Authenticating with Username/Password The DIGEST-MD5 SASL mechanism is available to support traditional XMPP or multi-protocol IM clients that are not customized for (or even aware of) Facebook. This mechanism requires prompting the user for his or her password; therefore, it should only be used when necessary. In particular, it MUST NOT be used for any client that: Proxies the XMPP connection (the connection must be directly from the user's computer to Facebook). Reports messages or any other information about user activity to a third party (including the client developer). Integrates with Facebook, or has a Facebook Application ID. If your application does any of the above, you must use Facebook Platform authentication instead.

Categories : Javascript

Which Linux system calls should I use to read raw characters from stdin?
Sorry for the delay (I really should "register" here - that'll get me "notifications", right?). As I said, it's rudimentary and imperfect. Some of the "usual" stuff may be defined elsewhere, but I think you can figure out how to get it to assemble. Just call it - no parameters - and the key is returned in al. Hope it's some use to you! ;----------------------------- ; ioctl subfunctions %define TCGETS 0x5401 ; tty-"magic" %define TCSETS 0x5402 ; flags for 'em %define ICANON 2 ;.Do erase and kill processing. %define ECHO 8 ;.Enable echo. struc termios alignb 4 .c_iflag: resd 1 ; input mode flags .c_oflag: resd 1 ; output mode flags .c_cflag: resd 1 ; control mode flags .c_lflag: resd 1 ; local mode flags .c_line: resb 1 ; l

Categories : Node Js

how to run an application in c++ and write to its stdin and read from its stdout in windows
You can spawn a child process and then gain access to its stdin and stdout pipes. You have to use WinAPI to achieve this. See example here: http://msdn.microsoft.com/en-us/library/ms682499(v=vs.85).aspx You may use Qt and it's QProcess class to read/write child process output/input.

Categories : C++

x86 Assembly (Linux) stdin read syscall returning 1 with no data input
You can't call sys_read with these parameters and to expect that there will be no input. sys_read is blocking call. So, it will block until some input appears. In your case, IMO, you press ENTER and in this case, sys_read returns with 1 byte read in the buffer - LF, ascii code 0Ah and eax=1. P.S. It is not my job, but better use FASM or at least NASM. This way you will get much more help in your ASM programming. GAS has really terrible syntax. :)

Categories : Linux

Incoming E-mail intercepted by PYTHON's ( sys.stdin.read(1024) ) is missing title and body content
a = sys.stdin.read(1024) reads no more than 1024 bytes. That is roughly the length of the email.txt you've posted. The discrepancy is probably due to redactions. So, if you want the entire message, use a = sys.stdin.read()

Categories : Python

cakephp: How read Auth in a model
in the constructor: public function __construct($id = false, $table = null, $ds = null) { parent::__construct($id, $table, $ds); $this->hasOne = array( 'Friend' => array( 'className' => 'Friend', 'conditions' => array('Friend.friend_id' => AuthComponent::user('id)) ) ); } Note that you need to use the model constructor here (basic OOP) and that you cannot just use a non-declared object dynamically. Only statically, and only because the user method allows you to do so. Even though it would be cleaner to attach such non-stateless bindings at runtime instead of doing it even for non-logged-in users and others who dont need that.

Categories : Cakephp

ASP.NET MVC 4 Read Persistent Auth Cookie Event?
You could write a custom AuthorizeAttribute: public class MyAuthorizeAttribute : AuthorizeAttribute { protected override bool AuthorizeCore(HttpContextBase httpContext) { var authorized = base.AuthorizeCore(httpContext); if (authorized) { httpContext.User = new ClaimsPrincipal(...) } return authorized; } } Now decorate your protected controller actions with this custom attribute instead of the default built-in: [MyAUthorize] public ActionResult Protected() { ... }

Categories : Asp Net Mvc

Is $this->Session->read('Auth.User.field') secure in cakePHP 2.3?
Well, depending on the type of authentication, AuthComponent::user() (it's a static method in Cake 2.x btw) reads the value from the session anyways (in case the static user cache is empty). So, in case the user would be able to modify the session value that holds the ID, both of these methods would be compromised. Nonetheless you'd better pass the value to the view from the controller, the view doesn't know about the proper key as it's defined on the Auth component, also the Auth component implementation might change causing the view not to be able to access the value like this anymore at all.

Categories : PHP

could not read Username for 'https://github.com': No such device or address
I think you need to set the git config via the command line. See the github setup documentation: https://help.github.com/articles/set-up-git#platform-all $ git config --global user.name "Your Name Here" $ git config --global user.email "your_email@example.com" Etc.

Categories : GIT

How to read a file in order to check if username has already been created
You can do something like below in you read method public String[] files() throws FileNotFoundException { List<String> existingUsers = new ArrayList<String>(); File users = new File("username.txt"); Scanner sc = new Scanner(users); while (sc.hasNext()) { existingUsers.add(sc.nextLine()); } return existingUsers.toArray(new String[existingUsers.size()]); }

Categories : Java

Scirpting AutoIT to read username and password from file
Not really a question, but here is the answer you are looking for: The file opening and reading doesn't have to be inside the loop, so should be outside... ... Especially since you aren't closing the file (see the FileClose function)... On the basis I have no settings.dat I'm guessing that it is a file you've created. There should be some error checking for whether it exists or not. As a general rule user config files belong in the user directory, rather than Program Files. If you want to store your program in Program Files then look at using either %AppData% or perhaps even the registry. For config files, .ini have built in AutoIt support and are easier for humans to edit when you have lots of settings. Using FileReadLine and giving a line number is very inefficient when you are actual

Categories : Google App Engine

read array name from STDIN and iterating through the array values
You can write: ARR1=(a b c) ARR2=(d e f) ARR3=(g h i) read array_name array_name="${array_name}[@]" # append '[@]' to array_name for i in "${!array_name}" ; do # use indirection to expand e.g. "${ARR1[@]}" echo "i is $i" done

Categories : Arrays

htaccess /profil.php?username=username to /username
You need to add a RewriteCond to stop the infinite loop of redirects. Options +FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !(profil.php) RewriteRule ^(.*)$ /profil.php?username=$1

Categories : Htaccess

laravel basic auth not working but auth::attempt does
Yes it might well be the server configuration but generally, i would say DON'T use the basic auth in a production environment, because its as its named "basic". In a screen cast Taylor made where he explained the use, I believe him saying its useful if you want to develop authenticated control panels but don't want to go into creating a log in page just yet. That said, I think you should use a more conventional HTML log in page, and if you really want basic auth, you should manually set that up using a .htpasswd file.

Categories : Laravel

return (mysql_result(mysql_query("SELECT COUNT('ID') FROM 'users' WHERE 'username' = '$username'") , 0) == 1) ? true : false;
In MySQL, identifier quote character is the backtick " ` " (not single quote) as stated here: http://dev.mysql.com/doc/refman/5.0/en/identifiers.html. Please update your query to use back ticks on table name and column names as follows: "SELECT COUNT(`ID`) FROM `users` WHERE `username` = '$username'" Because the query did not succeed, your mysql_query returned false which is the reason for that error. Please have a look at the documentation for mysql_query here http://php.net/manual/en/function.mysql-query.php and check the "Return Values" section thoroughly. Also as you mention tutorial then I believe you are beginning to learn PHP with DB development, in which case its better to start learning either mysqli http://php.net/manual/en/book.mysqli.php or PDO http://php.net/manual/en

Categories : PHP

How to validate a Username field which can take an email as username but also can use alphanumeric characters
Create two regex expressions and use || for truth validation. You need to append +.[A-Z]{2,4} to the email one for the proper domain extensions. it accepts 2-4 character domain extensions. You can adjust the 4 accordingly. ^[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4}$

Categories : Javascript

Fgets isn't getting any input from stdin or stdin isn't being equaled to the input?
The line while((c = get char()) != ' ' && c != EOF); needs to go directly AFTER the fgets, not before. Also, while not answering the question directly, its better to do fgets(cnumb1, sizeof cnumb1, stdin); then hardcode in the sizeof cnumb1, as @H2CO3 kindly pointed out to me.

Categories : Objective C

django-guardian - meaning of (User, 'username', 'username')
From the docs: Optionally, instances for which check should be made may be passed as an second argument or as a tuple parameters same as those passed to get_object_or_404 but must be provided as pairs of strings. So if you want to check permission of one User model instance, you can pass the tuple in order (ModelName, argname, varname) (note that argname and varname should be in pair) like: (User, 'username', 'username') It's the same as parameters in get_object_or_404() function: get_object_or_404(User, username=username) And similar if you have tuple (User, 'username', 'username', 'groups__name', 'group_name')... You can check the source code for more understanding: https://github.com/lukaszb/django-guardian/blob/master/guardian/decorators.py#L74

Categories : Django

Socket.io - How to prompt for username, and save the username in an array?
You can just add this to your server code: var users = []; game_room.sockets.on('connection', function (socket) { socket.emit('entrance', {message: 'Welcome to the chat room!'}); socket.emit('entrance', {message: 'Your ID is #' + socket.id}); socket.on('adduser', function (name) { users.push(name); // attempt to clean up socket.once('disconnect', function () { var pos = users.indexOf(name); if (pos >= 0) users.splice(pos, 1); }); }); // ... }); (it won't work if 2 users choose the same name.)

Categories : Node Js

Laravel, use auth and auth.basic
Use groups and define other routes inside them. Route::group(['prefix'=>'admin', 'before'=>'auth.basic'], function(){ Route::get('/', function(){}); }); Route::group(['prefix'=>'account', 'before'=>'auth.account'], function(){ Route::get('/', function(){}); });

Categories : PHP

CakePHP App with Auth + ACL and Plugin with Auth but no ACL
I have 2 possible suggestions for breaking the inheritence structure of CakePHP to prevent the plugin from loading the components Pseudo App Controller Create a new controller class for example MyAppController which extends the core AppController which can then be used as a parent for main app's controllers, while the core AppController which remains empty is used for the plugins. The plugins then do not inherit anything Your structure should be something like A normal AppController class // app/Controller/AppController.php class AppController extends Controller { // left empty intentionally } A pseudo-AppController for your plugin class MyAppController extends Controller { // all code for the main app // used for all your normal app controllers public $components

Categories : Cakephp

Getting the Auth Token with Ember-Auth
I don't know Ember-Auth, but to access properties in objects. You have to use the get method. Whistlr.Auth.get('authToken') I hope it helps.

Categories : Authentication

Wrong username given to my template when modifing the username
There are two ways to solve the problem: Using a separate field for the new username, and Using a form model. Separate Field You could create a separate field in your User class to hold the new username and copy it to the actual username after validation and before persisting — the same way you're currently doing with passwords. Form Model Basically, a form model is an object that embeds the actual model and those extra fields like newUsername or plainPassword. You would go this route if you don't want to clutter the actual model class with these extra fields.

Categories : Symfony2

VBA Get Username on OSX (or Mac alternative to Environ("username"))
You can use AppleScript to return the Username and run that from VBA. The following function should do the trick. Function GetUserNameMac() As String Dim sMyScript As String sMyScript = "set userName to short user name of (system info)" & vbNewLine & "return userName" GetUserNameMac = MacScript(sMyScript) End Function

Categories : Osx

Display username when adding comments My SQL cannot record the username, only display the current login user
In your code the $conn is not initialized anywhere. Initialize it like this before trying the query. $conn = mysqli_connect("localhost", "my_user", "my_password", "world"); Check the php manual for proper usage. Hope that helps :)

Categories : PHP

Invalid property 'username' of bean class [java.util.ArrayList]: Bean property 'username' is not readable or has an invalid getter method
Try to this code: @RequestMapping(value="/userList") public ModelAndView getUserList(){ List<User> userList = userService.getUserList(); ModelAndView mav = new ModelAndView("userList"); mav.addObject("userList", userList); mav.addObject("user", user); return mav; }

Categories : Spring

Rspec STDIN gets
In your spec you want to use $stdin. Your code should look something like this: it "sends an SMS and verifies it" do SMSVerifier.send_verification_code(test_phone_number) print "Enter the sms code you received: " code = $stdin.gets.chomp SMSVerifier.check_verification_code(test_phone_number, code).should == true end

Categories : Ruby

STDIN bar at the bottom
For text-based UI, you should reach for curses/ncurses. The Curses library is rather low-level, so you may prefer to use something like Curses::Toolkit—specifically the Curses::Toolkit::Widget::Entry class seems to do what you want—or Curses::UI. They may be overkill for your use case, but will scale well as you add more features to your client.

Categories : Perl

When is sys.stdin None in Python?
Interesting. You've answered half your own question. The other half ("how do I fix it") is easy enough, just open some suitable thing (os.devnull is the obvious one) and set sys.stdin to point there. You'll need to do sys.stdout and sys.stderr as well, presumably, so something like this: import os, sys for _name in ('stdin', 'stdout', 'stderr'): if getattr(sys, _name) is None: setattr(sys, _name, open(os.devnull, 'r' if _name == 'stdin' else 'w')) del _name # clean up this module's name space a little (optional) from wsgiref.handlers ... should do the trick.

Categories : Python

Handling stdin and stdout
This line: print p.stdout.read() # expected this to print output interactively. This actually hungs. hangs because read() means "read all data until EOF". See the documentation. It seems like you may have wanted to read a line at a time: print p.stdout.readline()

Categories : Python

StdIn not working... @ Linux
You need to setup your classpath to use external java libraries If you are using eclipse, you could Project - > Properties -> Java build path ->add Jar. That jar file should be placed in a directory inside your workspace (lib/ for example)

Categories : Java



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