定制 jncinet/laravel-email-captcha 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

jncinet/laravel-email-captcha

Composer 安装命令:

composer require jncinet/laravel-email-captcha

包简介

laravel email captcha.

README 文档

README

安装

$ composer require jncinet/laravel-email-captcha

在配置中如果使用了中文会被转成base64码,使用时需要在对应的配置文件中转回原文

示例:

...
'from' => [
        'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
        // 因为发件人名称使用了中文,所以在这里转回
        'name' => \Qihucms\Support\Str::decode(env('MAIL_FROM_NAME', 'Example')),
    ],
...

添加后台菜单

  • 菜单名称:邮件配置
  • 菜单链接:email-captcha/config

发送验证码请求

  • 地址: /email-captcha
  • 方法: POST
  • 参数:{"email": 'username@qihucms.com'}
  • 成功:{"status": "SUCCESS"}
  • 失败:{"errors":{"msg": "发送失败"},...}

示例

        function emailCaptcha(email) {
            var pattern = /^[A-Za-zd0-9]+([-_.][A-Za-zd]+)*@([A-Za-zd]+[-.])+[A-Za-zd]{2,8}$/;
            if(!pattern.test(email)){
                $.toast("@lang('email-captcha::email_captcha.email_error')", 'text');
                return false;
            }
            axios.post('{{ route('email.captcha') }}', {email})
                .then(function (response) {
                    $.toast(response.data.msg);
                    updateSendCaptchaText();
                })
                .catch(function (error) {
                    if (error.response.status === 422) {
                        var errors = error.response.data.errors, msg;
                        if (errors.length > 0) {
                            for (var i in errors) {
                                msg = errors[i][0];
                            }
                        } else {
                            msg = error.response.data.msg;
                        }
                        $.toast(msg, 'text');
                    } else {
                        $.toast("@lang('email-captcha::email_captcha.send_fail')", 'cancel');
                    }
                    clearInterval(c);
                    $('#sendCaptcha').text("@lang('email-captcha::email_captcha.send_btn_text')");
                    t = 0;
                });
        }

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-02-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固