I've been working through various hurtles toward migrating an existing Symfony3 web app from a local LAMP host up to Goggle's App Engine Standard PHP Environment. I've taken hints from the appengine-symfony-starter-project to use Memcache for sessions, pre-cache the application code, and connect to a Cloud SQL MySQL database. In have the core pieces working fine.
I added a login form at /login using a TWIG template with a form in it that goes like so:
<form class="form" action="{{ path('security_login') }}" method="post">
<input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}" />
<div class="form-group">
<input class="form-control" id="email" type="text" name="_email" placeholder="Email" value="{{ last_username }}"/>
</div>
<div class="form-group">
<input class="form-control" id="password" type="password" name="_password" placeholder="Password"/>
</div>
<div class="form-group">
<input type="checkbox" id="remember_me" name="_remember_me" checked>
<label for "remember_me">Remember Me</label>
</div>
<div class="form-group">
<button class="btn btn-round btn-b">Login</button>
</div>
<div class="form-group">Forgot Password?</div>
</form>
This works fine in the local DEV and TEST environments but when I push this up to GAE, I'm getting the error below:
Unable to load the "Symfony\Bridge\Twig\Form\TwigRenderer" runtime.
I've been digging for a couple hours now and haven't found a hit as to what's wrong here. Anyone have any ideas where to look?
Thanks in advance,
In my case "twig.strict_variables: true" to "twig.strict_variables: false" fixed an issue.
We encountered the same error this morning at work, in a Silex app.
This helped us: https://github.com/silexphp/Silex/pull/1571
It worked for us to change in our composer.json the version of symfony/form from ~2.8|^3.0 to ~2.8|3.3 as it appears TwigRenderer is deprecated in 3.4.
Hope this helps.
Related
I have this my sign up form in my php Laravel site which I think hackers and robots are making unnecessary sign-ups. But now, I want to allow only Valid Gmail users to create an account. I have configured this form but users with unknown mails are able to sign up. I'm a newbie in php Laravel codes. Someone should please help me configure this to achieve the goal. Thanks in advance. See form bellow.
#csrf
<div class="form-group">
<input type="text" name="name" class="form-control" placeholder="{{__('Full Name')}}">
</div>
<div class="form-group">
<input type="text" name="username" class="form-control" placeholder="{{__('Username')}}">
</div>
<div class="form-group">
<input type="email" name="email" class="form-control" placeholder="{{__('Gmail')}}">
</div>
<div class="form-group">
<input type="tel" name="tel" class="form-control" placeholder="{{__('WhatsApp Number')}}">
</div>
<div class="form-group">
<input type="text" name="gender" class="form-control" placeholder="{{__('Gender')}}">
</div>
<div class="form-group">
<input type="text" name="item" class="form-control" placeholder="{{__('What do you want to buy? Please type in your issues here')}}">
</div>
Laravel have great set of email validation tools. Here you can find some detail explanation: https://minuteoflaravel.com/validation/laravel-email-validation-be-aware-of-how-you-validate/
I think that will be enough to prevent most "hackers and robots" emails.
If you still want to accept "gmail.com" addresses only, then you can use, again, laravel ends-with validator:
'email' => ['ends_with:gmail.com', ...]
If you want to be sure that they are real emails then I suggest you implement laravel email verification
For more strict verification you can also use some external services like Mailgun email verification.
To stop bots from signing up, you can integrate a captcha service like ReCaptcha.
There are multiple packages which can help you reduce the amount of code to be written. Try having a look at laravel-recaptcha package on Github.
We are adding Moodle to our site (different server, different sub-domain, but same main domain, and the servers are set up to be able to communicate with each other) and what we want to have it do is:
if the User accesses the main site
User logs in User clicks a link to Moodle
The user is automatically logged into Moodle without
having to reenter their info.
i have added the html form with hidden type in my main domine as moodle post url.
Main domine:
<form class="mt-3" action="http://localhost/moodle/login/index.php" method="post" id="login">
<input id="anchor" type="hidden" name="anchor" value="">
<script>document.getElementById('anchor').value = location.hash;</script>
<input type="hidden" name="logintoken" value="xUe9G7a012vTHpvtOxAfzu84YJ046pu4">
<input type="hidden" name="loginhas" value="eda690fdf">
<div class="form-group">
<label for="username" class="sr-only">Username / email</label>
<input type="text" name="username" id="username" class="form-control" value="admin" placeholder="Username / email" autocomplete="username">
</div>
<div class="form-group">
<label for="password" class="sr-only">Password</label>
<input type="password" name="password" id="password" value="eda690fdf" class="form-control" placeholder="Password" autocomplete="current-password">
</div>
<div class="rememberpass mt-3">
<input type="checkbox" name="rememberusername" id="rememberusername" value="1">
<label for="rememberusername">Remember username</label>
</div>
<button type="submit" class="btn btn-primary btn-block mt-3" id="login">Log in</button>
How to accept this request in moodle ? or if you have any rolution regarding this issue plese help me out of this.
Don't know if possible with Moodle. We do it for several systems using CAS (central authentication service), where several yii2 apps login against a CAS implemented with web2py.
In the Yii side we use https://github.com/2amigos/yii2-usuario for user management and https://github.com/daxslab/yii2-cas-client for auth against the CAS.
Perhaps you need to implement a CAS on Yii and check how make that Moodle authenticates against it.
I am trying to get my development box to work so I can work on a development at home as not to alter and mess up the main site.
I get an error on the development box but not on the main site.
I have set everything up then copied the site via another tutorial. I was able to get all the requirements working and the site works except when I attempt to go to the log in page. I have searched the web for the method used for the route and I cannot find a good explanation of how it works so I can troubleshoot the problem.
div class="col-lg-6 col-md-8 col-sm-8 col-lg-offset-3 col-md-offset-1 col-sm-offset-2">
#if(Session::has('errors'))
<div class="alert alert-danger text-center">
#php ($errors = Session::get('errors'))
#php ($err = $errors->toArray())
{{$err['email'][0]}}
</div>
#endif
<form role="form" id="cust-login-frm" method="POST" action="{{ route('xxx') }}" >
{{csrf_field()}}
<input name="user_type" type="hidden" value="{{ Crypt::encrypt('XX') }}">
<div class="form-group">
<label>Email</label>
<input type="email" id="email" name="email" class="form-control" placeholder="Email" value="{{(Session::has('failed')) ? Session::get('failed') : ''}}">
</div>
<div class="form-group">
<label>Password</label>
<input type="password" id="password" name="password" class="form-control" placeholder="Password">
</div>
<div class="clearfix"></div>
</form>
<div class="form-group col-lg-12 submitbtn">
<!-- <input type="hidden" name="save" value="contact"> -->
<button id="cust-login-btn" class="btn btn-primary" type="button">Sign In</button>
</div>
<center><div> Not Registrated? Register | Forgot Password? </div></center>
The issue I am having is the hyperlink towards the bottom "{{route('customer.password.request') }}" The route before it I can find and follow but this one with the dot notation I cannot. I cannot provide too many details as this is a live site. I suspect this broke due to my command composer update. The main site was not coded by me and has tons of issues. But it will work and its the same. This one is difficult as the main laravel.org does not have much on the subject. If a guru here can point me to a tutorial or page that will help me understand why I am getting the error "Route [customer.password.request] not defined. (View: /var/www/html/resources/views/customer/auth/xxx.blade.php)". Thanks community. :)
NOTE: I have removed some parts to hide real filenames with xxx.
Define the route name in web.php
Route::any('urlname','controllername#functionname')->name('customer.password.request');
Ok the answer to my question here is this.
I found out that the routes were placed in the wrong location.
The morons who did this put the routes in the vender folder file. This was changed when I did an update. So I decided to move them to the web.php and it worked.
So this issue can be closed.
Thanks.
I'm building a simple blog for my personal projects with Laravel 5.4.36. I have uploaded it to 000webhost. The problem is everytime I`m trying to sign up or sign in, it is saying,
The requested URL was not found on this server
Here is the URL that is shown during this error,
https://myprojectblog.000webhostapp.com/signUp
Here 'signUp' or 'signIn' are provided in the routes file which are given below,
Route::post('/signUp', [
'uses'=>'UserController#postSignUp',
'as'=>'signUp'
]);
Route::post('/signIn', [
'uses'=>'UserController#postSignIn',
'as'=>'signIn'
]);
The sign up form is given below,
<div class="signUp">
<label>Sign Up</label></br>
<form action="{{ route('signUp') }}" method="POST" name="signUp" id="signUp">
<label id="usernameLabelSignUp">Username</label></br>
<input type="text" id="usernameSignUp" name="username" value="{{ Request::old('username')}}"></br>
<label id="emailLabelSignUp">Email</label></br>
<input type="text" id="emailSignUp" name="email" value="{{ Request::old('email')}}"></br>
<label id="passwordLabelSignUp">Password</label></br>
<input type="password" id="passwordSignUp" name="password"></br>
<input type="hidden" name="_token" value="{{ Session::token() }}">
<input type="submit" id="signUpSubmit" value="signUp">
</form></br>
</div>
In the cpanel of 000webhost my file structure is,
/
-Blog
-All the Laravel project directories and files except public
-public_html
-public
-css
-js
-.htacess
-index.php
-favicon.ico
-robots.txt
-web.config
My index.php in /public_html/public got included these lines,
require __DIR__.'/../Blog/bootstrap/autoload.php';
$app = require_once __DIR__.'/../Blog/bootstrap/app.php';
The index page loads without any trouble, but while trying to sign in or up the error occurs.
Most importantly everything runs absolutely fine in my local machine, no trouble at all.
Some clue would mean great help. Thank you.
I found a similar question here that someone wanted to create a user account loggin similar to this, but it lead me to believe it has to be all done in php in order to handle it and put into a MySQL database. From my understanding this isn't php and it is on the main html website.
How is the data captured and then stored on a database with this code then?
This is taken directly form http://cardoneuniversity.com/
<span class="dominate-and-login-form-text">Already a member?</span>
<form action="https://login.lightspeedvt.com/actions.cfm?lg=447&v=35" method="POST">
<input type="hidden" name="action" value="login">
<div class="form-group username-field">
<label class="sr-only" for="exampleInputUser3">Username</label>
<input name="username" type="text" class="form-control" id="exampleInputUser3" placeholder="Username">
</div>
<div class="form-group password-field">
<label class="sr-only" for="exampleInputPassword3">Password</label>
<input name="password" type="password" class="form-control" id="exampleInputPassword3" placeholder="Password">
</div>
<button type="submit" class="btn btn-default login-univ-btn">Login</button>
<br>
<i>Forgot Username/Password?</i>
</form>
If I seem like nothing more then an uneducated lost programmer, can you care to send me in the direction to learn?
I'm trying to create a learning/course website like this one.
Actually this form is processed by ColdFusion. ColdFusion does a similar job to PHP where it is a server side scripting language. Here is a good tutorial that will teach the basics of a login system using HTML, MySQL and PHP.
User Membership With PHP
For a more advanced and secure tutorial check this out:
How to Create a Secure Login Script in PHP and MySQL