承接 zazama/doubleoptin 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

zazama/doubleoptin

Composer 安装命令:

composer require zazama/doubleoptin

包简介

A Silverstripe 4 module to implement GDPR required E-Mail double-opt-in.

README 文档

README

Packagist Version GitHub Scrutinizer code quality (GitHub/Bitbucket)

Introduction

DoubleOptIn extends Silverstripe and Userforms to implement a Double-Opt-In solution that is often required by new GDPR law. It will add a checkbox to Userforms to send a verification email before the submission/email is viewable/sent.

Requirements

  • silverstripe/framework ^4.0
  • silverstripe/admin ^1.0
  • silverstripe/userforms ^5.0

This module was only tested on the newest 4.4.

Installation

composer require zazama/doubleoptin

YAML configuration

# set a route for verification links
SilverStripe\Control\Director:
  rules:
    'verify': Zazama\DoubleOptIn\Controllers\VerificationController
Zazama\DoubleOptIn\Models\EmailVerification:
  url_segment: 'verify'
  # subject is ignored with Userforms, because that's set in admin frontend.
  subject: 'Email Verification'
# set sender for the verification email
Zazama\DoubleOptIn\Services\EmailSender:
  email_sender: 'example@yourdomain.com'

Userforms settings

  • To enable DoubleOptIn in a Userforms page, go to the Configuration tab and click "Enable Double-Opt-In"
  • Choose the Double-Opt-In E-Mail field (required, too)
  • Enter your verification email subject.

Usage with normal forms

    use Zazama\DoubleOptIn\Models\EmailVerification;

    public function handleFormVerification($data, $subject) {
        $email = $data['email'];
        $emailVerification = EmailVerification::create();
        $emailVerification->init($email);
        $emailVerification->send($subject);
        $emailVerification->write();
    }
    
    public function tokenChecks() {
        EmailVerification::IsSuccess($token); //bool
        EmailVerification::IsAlreadyVerified($token); //bool
        EmailVerification::IsBadToken($token); //bool
        EmailVerification::TokenType($token); //string
    }

Templates

The following templates can be overriden:

  • Zazama\DoubleOptIn\Layout\Verification_Success
  • Zazama\DoubleOptIn\Layout\Verification_BadToken
  • Zazama\DoubleOptIn\Layout\Verification_AlreadyVerified
  • Zazama\DoubleOptIn\Email\Email

If you just want to change the text, you can change the language strings.

Extension hooks

There are extension hooks provided to use the Verification controller.

class x extends Zazama\DoubleOptIn\Controllers\VerificationController {
  # called when successfully verified
  public function updateSuccess($token) {}

  # called when verification token is wrong / not provided
  public function updateBadToken() {}

  # called when verification token is already verified
  public function updateAlreadyVerified() {}
}

class y extends Zazama\DoubleOptIn\Models\EmailVerification {
  # change generated token
  public function updateGenerateToken($token) {}

  # change link
  public function updateLink($link) {}

  # change subject
  public function updateSubject($subject) {}
}

统计信息

  • 总下载量: 155
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2019-10-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固