Search code examples
authenticationsymfony1sfguard

[Symfony]--sfGuardPlugin--SignIn


I use symfony 1.4

In my index page, I have created some fields as login form.

When using sfGuardPlugin, it generate automaticly its form.

So, what I'm searching for is how to replace the default form created by the new which I have created.

thanks


Solution

  • By default, sfGuardAuth module comes with 2 very simple templates:

    • signinSuccess.php
    • secureSuccess.php

    If you want to customize one of these templates:

    • Create a sfGuardAuth module in your application (don't use the init-module task, just create a sfGuardAuth directory)

    • Create a template with the name of the template you want to customize in the sfGuardAuth/templates directory

    • symfony now renders your template instead of the default one

    More info: https://github.com/Garfield-fr/sfDoctrineGuardPlugin

    Edit:

    You must set up the settings.yml

       enabled_modules: [default, sfGuardAuth, sfGuardUser]
      .actions:
        login_module: sfGuardAuth
        login_action: signin
    

    This is my signinSuccess.php

    <h2>Bejelentkezés</h2>
    <form id="loginform" action="<?php echo url_for('@sf_guard_signin') ?>" method="post">
        <input type="hidden" name="signin[_csrf_token]" value="2a831d070cdd61d81bb1572be3f52d21" id="signin__csrf_token" />                 <p>
            <label class="required" for="username">Felhasználónév vagy Email:</label><br/>
    
            <input type="text" name="signin[username]" id="signin_username" class="text" />                 </p>
    
        <p>
            <label class="required" for="password">Jelszó:</label><br/>
            <input type="password" name="signin[password]" id="signin_password" class="text" />                 </p>
    
        <p>
            <input type="submit" class="btn btn-green big" value="Signin" />&nbsp; 
    
        </p>
        <div class="clear">&nbsp;</div>
        <?php echo $form->renderHiddenFields(); ?>
    </form>