I am trying to use Titanium Alloy ACS to handle forgotten passwords.
In my controller I am running the following code:
this.config.Cloud.Users.requestResetPassword({
email : usersEmail,
template : "forgot_password"
}, function(e) {
if (e.success) {
alert('You will receive an email soon with your password details.');
} else {
Ti.API.error(e);
_callback && _callback({
success : false,
model : null,
error : e
});
}
});
On Appcelerator I have created an email template as follows:
The error I am getting is:
[ERROR] : 422: Failed to send email: Email template forgot_password is not found
[ERROR] : {
[ERROR] : code = 422;
[ERROR] : error = 1;
[ERROR] : message = "Failed to send email: Email template forgot_password is not found";
[ERROR] : success = 0;
[ERROR] : }
Does anyone know what I might be doing wrong?
The problem was due to me getting confused between the Appcelerator settings for the production version and the development version, once I had copied over the email template settings to the development version from the production version it worked fine.
Related
in Strapi 4.0, i want to validate the input before saving. So i created lifecycles.js file as per the documentation and added the code:
module.exports = {
beforeCreate(event) {
//validation login here;
if (!valid) {
throw strapi.errors.badRequest('Invalid Entry');
}
},
}
How ever throw strapi.errors.badRequest('Invalid Entry'); is giving an error :
Cannot read property 'badRequest' of undefined
My guess is the Strapi v4 changed it from version 3. I looked everywhere but couldn't find a solution.
Any idea on how to handle error in lifecycles.js?
I had a similar situation with a forbidden error. I got to do it importing a class from #strapi/utils/lib/errors.js
const { ForbiddenError } = require("#strapi/utils").errors;
...
if (!authorized) {
throw new ForbiddenError(errorMessage);
}
You can show the list of errors based on your requirement
const { ValidationError } = require("#strapi/utils").errors;
...
if (formValidationError) {
throw new ForbiddenError("Fill the form");
}
Strapi comes with a lot of error response functions here are they
HttpError,
ApplicationError,
ValidationError,
YupValidationError,
PaginationError,
NotFoundError,
ForbiddenError,
PayloadTooLargeError,
UnauthorizedError,
PolicyError,
In my Laravel project, I am using the laravelgooglemaps api by farhanwazir on my "contact us" page to display a fixed location.
Route for contactus page:
Route::get('/contactus', function () {
$config['center'] = 'California State University, Fullerton';
$config['zoom']='15';
$config['map_height'] = "300px";
$config['map_width'] = "300px";
$config['scrollwheel']= false;
GMaps::initialize($config);
$marker['position'] = 'California State University, Fullerton';
$marker['infowindow_content'] = 'Easywash Centre';
GMaps::add_marker($marker);
$map = GMaps::create_map();
return view('contactus')->with('map', $map); });
In my contactus.blade.php file:
{!! $map['html'] !!}
But sometimes when I load the "contact us" page I get the error:
ErrorException (E_WARNING)
file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed
Can anyone help me understand why I am getting such error and how it can be solved?
Try this:
$arrContextOptions=array(
"ssl"=>array(
"verify_peer"=>false,
"verify_peer_name"=>false,
),
);
file_get_contents($link, false, stream_context_create($arrContextOptions));
Just in case anyone wondering I solved this error by changing https:// to http:// .
I am using Alamofire 4.5, and XCode 9.0.1. I cannot connect to my local Nginx configured with a self-signed cert.
As per this answer, I am using the following code:
private static var Manager : Alamofire.SessionManager = {
// Create the server trust policies
let serverTrustPolicies: [String: ServerTrustPolicy] = [
"localhost:8443": .disableEvaluation
]
// Create custom manager
let configuration = URLSessionConfiguration.default
configuration.httpAdditionalHeaders = Alamofire.SessionManager.defaultHTTPHeaders
let man = Alamofire.SessionManager(
configuration: URLSessionConfiguration.default,
serverTrustPolicyManager: ServerTrustPolicyManager(policies: serverTrustPolicies)
)
return man
}()
And making the call like this:
DataService.Manager.request("https://localhost:8443/foo", parameters: parameters).validate().responseJSON
I tried various configurations in my project, but to no avail:
Here is the error I am seeing:
2017-10-27 08:59:17.118751-0600 hptest[53607:8423753] TIC SSL Trust
Error [1:0x60400016e580]: 3:0
2017-10-27 08:59:17.119020-0600 hptest[53607:8423753]
NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL,
-9813)
2017-10-27 08:59:17.119111-0600 hptest[53607:8423753] Task <A8A3F1A4-
D6A5-4AD6-9C3F-23697D8B63AD>.<1> HTTP load failed (error code: -1202
[3:-9813])
2017-10-27 08:59:17.119281-0600 hptest[53607:8423742] Task <A8A3F1A4-D6A5-4AD6-9C3F-23697D8B63AD>.<1> finished with error - code: -1202
Error Domain=NSURLErrorDomain Code=-1202 "The certificate for this server is invalid. You might be connecting to a server that is pretending to be “localhost” which could put your confidential information at risk." UserInfo={NSURLErrorFailingURLPeerTrustErrorKey=<SecTrustRef: 0x6000001149a0>, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9813, NSErrorPeerCertificateChainKey=(
"<cert(0x7fc41b870000) s: localhost i: localhost>"
), NSUnderlyingError=0x60800005f980 {Error Domain=kCFErrorDomainCFNetwork Code=-1202 "(null)" UserInfo={_kCFStreamPropertySSLClientCertificateState=0, kCFStreamPropertySSLPeerTrust=<SecTrustRef: 0x6000001149a0>, _kCFNetworkCFStreamSSLErrorOriginalValue=-9813, _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9813, kCFStreamPropertySSLPeerCertificates=(
"<cert(0x7fc41b870000) s: localhost i: localhost>"
)}}, NSLocalizedDescription=The certificate for this server is invalid. You might be connecting to a server that is pretending to be “localhost” which could put your confidential information at risk., NSErrorFailingURLKey=https://localhost:8443/foo, NSErrorFailingURLStringKey=https://localhost:8443/foo, NSErrorClientCertificateStateKey=0}
I managed to solve it with the following code for the session manager -- should have RTFM instead of SO first:
private static var Manager : Alamofire.SessionManager = {
// Create the server trust policies
let serverTrustPolicies: [String: ServerTrustPolicy] = [
"localhost:8443": .disableEvaluation
]
// Create custom manager
let configuration = URLSessionConfiguration.default
configuration.httpAdditionalHeaders = Alamofire.SessionManager.defaultHTTPHeaders
let man = Alamofire.SessionManager(
configuration: URLSessionConfiguration.default,
serverTrustPolicyManager: ServerTrustPolicyManager(policies: serverTrustPolicies)
)
man.delegate.sessionDidReceiveChallenge = { session, challenge in
var disposition: URLSession.AuthChallengeDisposition = .performDefaultHandling
var credential: URLCredential?
if challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust {
disposition = URLSession.AuthChallengeDisposition.useCredential
credential = URLCredential(trust: challenge.protectionSpace.serverTrust!)
} else {
if challenge.previousFailureCount > 0 {
disposition = .cancelAuthenticationChallenge
} else {
credential = man.session.configuration.urlCredentialStorage?.defaultCredential(for: challenge.protectionSpace)
if credential != nil {
disposition = .useCredential
}
}
}
return (disposition, credential)
}
return man
}()
I tried to run the Hyperloop Sample app but, even if it compiles fine, I get lots of errors anytime I tap any of the tableview cells:
[ERROR] : Script Error {
[ERROR] : column = 26;
[ERROR] : line = 7;
[ERROR] : message = "Can't find variable: Hyperloop";
[ERROR] : sourceURL = "file:///Users/sportgoofy/Library/Developer/CoreSimulator/Devices/AC1AEB23-14C4-44A2-9790-7025AB7BE76F/data/Containers/Bundle/Application/68239ABB-3492-4A9F-8F45-7C98F710B230/Hyperloop_Sample.app/hyperloop/uikit/uilabel.js";
[ERROR] : }
[ERROR] : Script Error Module "hyperloop/uikit/uilabel" failed to leave a valid exports object
[ERROR] : ErrorController is up. ABORTING showing of modal controller
[ERROR] : Script Error {
[ERROR] : column = 26;
[ERROR] : line = 7;
[ERROR] : message = "Can't find variable: Hyperloop";
[ERROR] : sourceURL = "file:///Users/sportgoofy/Library/Developer/CoreSimulator/Devices/AC1AEB23-14C4-44A2-9790-7025AB7BE76F/data/Containers/Bundle/Application/68239ABB-3492-4A9F-8F45-7C98F710B230/Hyperloop_Sample.app/hyperloop/localauthentication/lacontext.js";
[ERROR] : }
[ERROR] : Script Error Module "hyperloop/localauthentication/lacontext" failed to leave a valid exports object
[ERROR] : ErrorController is up. ABORTING showing of modal controller
[ERROR] : Script Error {
[ERROR] : column = 26;
[ERROR] : line = 7;
[ERROR] : message = "Can't find variable: Hyperloop";
[ERROR] : sourceURL = "file:///Users/sportgoofy/Library/Developer/CoreSimulator/Devices/AC1AEB23-14C4-44A2-9790-7025AB7BE76F/data/Containers/Bundle/Application/68239ABB-3492-4A9F-8F45-7C98F710B230/Hyperloop_Sample.app/hyperloop/uikit/uiview.js";
[ERROR] : }
[ERROR] : Script Error Module "hyperloop/uikit/uiview" failed to leave a valid exports object
[ERROR] : ErrorController is up. ABORTING showing of modal controller
What happens?
You probably ran into https://jira.appcelerator.org/browse/TIMOB-20469 which has been fixed recently. We hope to have a new HL beta out this week.
I have an issue with parse + unity in WebGL, it works perfectly in android or pc, but when i test in web this error appears
exception thrown: SyntaxError: Failed to execute 'setRequestHeader' on 'XMLHttpRequest': 'sme 0' is not a valid HTTP header field value.,Error: Failed to execute 'setRequestHeader' on 'XMLHttpRequest': 'sme 0' is not a valid HTTP header field value.
at Error (native)
at _JS_WebRequest_SetRequestHeader (http://localhost:60265/Release/Web.js:1:299623)
at aAg (http://localhost:60265/Release/Web.js:28:772491)
at YBc (http://localhost:60265/Release/Web.js:23:638406)
at Array.Are (http://localhost:60265/Release/Web.js:24:499286)
at U4p (http://localhost:60265/Release/Web.js:5:760172)
at Z4p (http://localhost:60265/Release/Web.js:5:770191)
at bXo (http://localhost:60265/Release/Web.js:9:582682)
at Array.vWo (http://localhost:60265/Release/Web.js:9:501983)
at Array.dap (http://localhost:60265/Release/Web.js:9:944092)Module.printErr # (index):34Browser.mainLoop.runIter # Web.js:1Browser_mainLoop_runner # Web.js:1
Do you know if this is a bug?
I'm using a personal edition of unity
It was tested in chrome and firefox, in both cases appears an error
EDITED
this code breaks the WebGL game
ParseUser.LogInAsync ("aaaaaa", "bbbbbb").ContinueWith (t => {
if (t.IsFaulted || t.IsCanceled){
ParseUser user = new ParseUser ();
user ["username"] = "aaaaaa";
user ["password"] = "bbbbbb";
ParseUser.LogOutAsync().ContinueWith(c=>{
user.SignUpAsync().ContinueWith(b =>{
if (b.IsFaulted || b.IsCanceled){
print ("signup fail");
}else{
print ("signup success");
}
});
});
}else{
print ("login success");
}
});