Is there any way to use Laravel's Auth and Hash, but change the bcrypt cost?
The default is defined here http://laravel.com/api/source-class-Illuminate.Hashing.BcryptHasher.html
Take a look at the make method.
You can pass an options array as the second parameter, where you can define the cost value.
Hash::make('stringtobehashed', array('cost' => 20));
I know this thread is very old, but just for quick reference,
If you're using Laravel 4.0 and up, change cost to rounds. You can look at the code here.
EDIT:
Alternatively and as of Laravel 4.2, you can set the rounds once and for all, in some ServiceProvider's boot method (probably in the AppServiceProvider), using:
Hash::setRounds(12);
Related
After creating a teams-tab-app using the vscode teams toolkit, I see that in the default auth-start.html file the script tries to extract the scopes from the URL (that was constructed by the microsoftTeams.authentication.authenticate() method), however I don't see any reference in the documentation on how to pass these scopes in this method.
Does anyone know how to pass these scopes?
I've wondered about this myself when looking at a toolkit, but I haven't used it for any production systems so never bothered to look too deep. I do see that in useTeamsFx.tsx is where it's doing the redirect to startLoginPageUrl, so presumably you need to set REACT_APP_START_LOGIN_PAGE_URL to be the path to the auth-start.html, so you could set it to include a querystring as well. It needs the app Id so you'd need to set that as well, but the useTeamsFx also wants REACT_APP_CLIENT_ID which you'd set as well. As a result, it might make sense to store the scopes you want in your code or in an environment variable as well, and then compose the value you send to initiateLoginEndpoint. Basically, instead of
var startLoginPageUrl = process.env.REACT_APP_START_LOGIN_PAGE_URL;
...
initiateLoginEndpoint: startLoginPageUrl
...
you might instead make it
var startLoginPageUrl = process.env.REACT_APP_START_LOGIN_PAGE_URL;
var scopes = process.env.REACT_APP_SCOPES; // <-- this is added
...
initiateLoginEndpoint: `${startLoginPageUrl}?clientId=${clientId}&scope=${scopes}`
...
but this is untested, so no guarantees.
On a separate but related note, in my sample project, in auth-start, it refers to a very old version of MicrosoftTeams.min.js (v 1.6, and current is 1.11). I might just have a very old Teams Toolkit, but maybe not...
I'm using the Dark Sky Forecast API to retrieve some weather information.
When I read the official doc, I found that the "option" section describes the usage of query parameters.
For example,
The API request may optionally be modified through the use of query parameters. It will respond to the following:
callback=[callback]: Return the API response as JSONP. Please use
caution when using this, since exposing your API key to the public is
a security hazard and, if abused, will result in the revokation of
your API key. However, if developing a personal- or internal-use app,
this is a convenient method of doing so.
units=[setting]: Return the
API response in units other than the default Imperial units. In
particular, the following settings are possible:
us: The default, as outlined above.
si: Returns results in SI units. In particular, properties now have the following units:
...
I know how to get the weather information by take advantages of the call
https://api.forecast.io/forecast/APIKEY/LATITUDE,LONGITUDE
But I don't know how to combine the query parameters with it.
Any ideas?
2015/10/23 UPDATE
Thank to Logan Kearns, using ? parameter solved my question. Make sure the query parameters are in lowercase.
https://api.forecast.io/forecast/APIKEY/LATITUDE,LONGITUDE?lang=zh-tw&units=si
This is how you change the units. I assume that other query parameters would be set in a similar manner, using the '?' to separate them.
https://api.forecast.io/forecast/APIKEY/LATITUDE,LONGITUDE?UNITS=us
Just an update, since url changed and with few other parameters:
You can add units to mention the type of unit conversion required
You can add exclude for excluding certain data in the response like hourly updates.
https://api.darksky.net/forecast/APIKEY/LAT,LONG?units=si&exclude=minutely,hourly,daily,alerts
I'd like to use didLoad callback for 'DS.MODEL.FIND', but can not find 'DS.MODEL.FIND' method in below webpage.
Also can not find "findQuery", Thanks.
http://emberjs.com/api/data/classes/DS.Model.html
find and similar methods should be called from the store now.
For example, if you have a model App.Post you can look up the record with id 1 in a route or controller with:
this.store.find('post', 1)
Instead of how you would in 0.13:
App.Post.find(1)
Also, I recommend using the latest build as there have been a lot of fixes since beta 2.
I'm using the Login snippet in MODx Revo and I'm trying to put the template directly in the loginTpl and logoutTpl properties but nothing is being output. Below is my code. What am I doing wrong?
Thanks in advance!
[[!Login? &tplType=`inline` &loginTpl=`<span>Log In</span>` &logoutTpl=`<span>[[+username]]</span>`]]
The placeholders are evaluated before snippet is processed, i.e. before the #INLINE tpl is ever used.
Use chunks;
Or non-cacheable placeholder (has not been tested):
[[!Login? &tplType=`inline` &loginTpl=`<span>Log In</span>` &logoutTpl=`<span>[[!+username]]</span>`]]
It fully works, check to see if login component is installed (it is not installed by default).
I am using a route like this
match "/v1/:method" => "v1#index"
My intention here is capture the name of the api method and then send the request to that method inside the controller.
def index
self.send params[:method], params
end
I figured this would send the other parameters as an argument to the method, but it didn't work. So my question is how can I pass the non-method parameters in a query string?
#query_parameters does exactly what you want:
request.query_parameters
It's also the most efficient solution since it doesn't construct a new hash, like the other ones do.
Stolen from the work of a colleague. I find this a slightly more robust solution, since it will work even if there are changes to the path parameters:
params.except(*request.path_parameters.keys)
I sort of solved this problem by doing this:
params.except("method","action","controller")