sopinet/autologin-bundle

There is no license information available for the latest version (dev-master) of this package.

Symfony AutologinBundle

Installs: 115

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 11

Forks: 0

Open Issues: 1

Type:symfony-bundle

dev-master 2015-08-12 07:57 UTC

This package is not auto-updated.

Last update: 2024-04-27 12:08:56 UTC


README

When you receive a notification, invitation, etc. by email with a URL to your site, you have to login everytime. With this module, you will login automatically when you click on URL, it's too easy. Come on!

Prerequisites

This module works with FOSUserBundle (see Documentation)

Installation

composer.json

$ php composer.phar require sopinet/autologin-bundle 'dev-master'

AppKernel.php

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Sopinet\AutologinBundle\SopinetAutologinBundle(),
    );
}

config.yml

# app/config/config.yml
sopinet_autologin:
    domain: http://domain.com

routing.yml

# app/config/routing.yml
sopinet_autologin:
    resource: "@SopinetAutologinBundle/Resources/config/routing.yml"
    prefix:   /

How to use

Generate the URL

<?php
$url = $this->container->get('urlhelper')->generateUrl($route, $user);

$message = \Swift_Message::newInstance()
		->setSubject(...)
		->setFrom(...)
		->setTo(...)
		->setBody($this->container->get('templating')->render('your_template.html.twig', array('url' => $url)), 'text/html');