Giter Site home page Giter Site logo

oc-buddies-plugin's Introduction

Component "Registration"

You can choose an email template in the settings.

Component properties:

  • Mode (Submit form/Ajax form)
  • Send flash message (only for Ajax mode)
  • Enable redirect
  • Choose page for redirect (the URL of the page will be passed to the user ID)
  • Auto login user after registration
  • Activation of user after registration:
    • Enable
    • Disable
    • Send activation email

Usage: The component is used to process the user registration form. Required fields are: email, password, password_confirmation. To send an ajax request, you must use the Registration::onAjax method.

**Example 1 (ajax submit)

[Registration]
mode = "ajax"
redirect_on = 1
redirect_page = "registration_success"
activation = "activation_on"
force_login = 1
==
$('form').request('Registration::onAjax');

Example 2 (Submit form).

[Registration]
mode = "submit"
redirect_on = 1
redirect_page = "registration_success"
activation = "activation_on"
force_login = 1
==

{% set arError = Registration.getErrorMessage %}
{% set arForm = Registration.getOldFormData %}

<form href="{{ 'registration'|page }}">
    <label for="field-email">Email</label>
    <input type="email" id="field-email" placeholder="Email" name="email" value="{{ arForm.email }}">
    {% if arError.message is not empty and arError.field == 'email' %}
        <p>{{ arError.message }}</p>
    {% endif %}
    
     <label for="field-company-name">Company name</label>
    <input type="text" id="field-company-name" placeholder="My company" name="property[company_name]" value="{{ arForm.property.company_name }}">
    
    <label for="field-password">Password</label>
    <input type="password" id="field-password" name="password">
    
    <label for="field-password-confirmation">Password confirmation</label>
    <input type="password" id="field-password-confirmation" name="password_confirmation">
    
    <button type="submit">Submit</button>
</form>
{% if arError.message is not empty %}
    <p>{{ arError.message }}</p>
{% endif %}

The Registration.getOldFormData method returns the filled form fields, if the form was sent and an error occurred. The Registration.getErrorMessage method returns an error message if the form was sent and an error occurred.

[
    'message' => 'Error message',
    'field'   => 'email',           //Field name, if there was a validation error
]

onCheckEmail() method

The method adds the ability to check the availability of email

Example (Send ajax request)

$.request('Registration::onCheckEmail', {
    data: {'email': $('input[name="email"]').val()},
    success: function(data) {
        if(data.status) {
            //Email is available
        } else {
            //Email is not available
        }
    }
});

Event "lovata.buddies::mail.registration.template.name"

You can add additional fields in the email template. By default, the 'lovata.buddies::mail.registration' template is used. To integrate with the Translate plugin, you need to create templates for languages with suffix = language code. For example:

  • 'lovata.buddies::mail.registration' - for default language
  • 'lovata.buddies::mail.registration_ru' - for language with code 'ru'
Event::listen('lovata.buddies::mail.registration.template.data', function($obUser) {
    ...
    
    //Return array with addition fields
    return $arResult;
});

Component "ActivationPage"

Usage: The component is used to activate the user in the activation mode by the link in the sent email.

Example

[ActivationPage]
slug = ":slug"
force_login = 1
redirect_on = 0
redirect_page = ""
==

Component "Login"

Component properties:

  • Mode (Submit form/Ajax form)
  • Send flash message (only for Ajax mode)
  • Enable redirect
  • Choose page for redirect (the URL of the page will be passed to the user ID)

Usage: The component is used to process the user authorization form. To send an ajax request, you must use the Login::onAjax method.

**Example 1 (ajax submit)

[Login]
mode = "ajax"
redirect_on = 1
redirect_page = "index"
==
$('form').request('Login::onAjax');

Example 2 (Submit form)

[Login]
mode = "submit"
redirect_on = 1
redirect_page = "index"
==

{% set arError = Login.getErrorMessage %}
{% set arForm = Login.getOldFormData %}

<form href="{{ 'login'|page }}">
    <label for="field-email">Login</label>
    <input type="email" id="field-email" placeholder="Email" name="email" value="{{ arForm.email }}">
    {% if arError.message is not empty and arError.field == 'email' %}
        <p>{{ arError.message }}</p>
    {% endif %}
    
    <label for="field-password">Password</label>
    <input type="password" id="field-password" name="password">
    
    <label for="field-remember_me">Remember me</label>
    <input type="checkbox" id="field-remember_me" name="remember_me">
    
    <button type="submit">Submit</button>
</form>
{% if arError.message is not empty %}
    <p>{{ arError.message }}</p>
{% endif %}

The Login.getOldFormData method returns the filled form fields, if the form was sent and an error occurred. The Login.getErrorMessage method returns an error message if the form was sent and an error occurred.

[
    'message' => 'Error message',
    'field'   => 'email',           //Field name, if there was a validation error
]

onSocialiteLogin() method

Redirect to social login page

Example (Send ajax request)

$.request('Login::onSocialiteLogin', {
    data: {'driver': 'facebook'}
});

Integration with laravel/socialite package

Documentation for Socialite can be found on the Laravel website or Socialite Providers site.

Installation guide

You need to add laravel/socialite package and other socialite packages from Socialite Providers list to your composer.json file.

{
    "require": [
        ...
        "laravel/socialite": "^3.1",
        "socialiteproviders/vkontakte": "^4.0",
        "socialiteproviders/instagram": "^3.0",
    ],

Execute below at the root of your project.

composer update

You can also install only packages and its dependencies without updating other packages by specifying the package.

composer require laravel/socialite

Registration Socialite service provider

You need to register service provider class in your config/app.php file.

'providers' => array_merge(include(base_path('modules/system/providers.php')), [
    // 'Illuminate\Html\HtmlServiceProvider', // Example
    
    'System\ServiceProvider',
    \Laravel\Socialite\SocialiteServiceProvider::class,
]),


'aliases' => array_merge(include(base_path('modules/system/aliases.php')), [

    // 'Str' => 'Illuminate\Support\Str', // Example
    'Socialite' => Laravel\Socialite\Facades\Socialite::class,
]),

Integration with socialite package from Socialite Providers list.

For example: integration with socialiteproviders/instagram package.

  1. Install package
composer require socialiteproviders/instagram
  1. Remove Laravel\Socialite\SocialiteServiceProvider from your providers[] array in config\app.php if you have added it already. Add \SocialiteProviders\Manager\ServiceProvider::class to your providers[] array in config\app.php.
'providers' => array_merge(include(base_path('modules/system/providers.php')), [
    // 'Illuminate\Html\HtmlServiceProvider', // Example
    
    'System\ServiceProvider',
    \SocialiteProviders\Manager\ServiceProvider::class,
]),
3. Add event listener
```php
\Event::listen(\SocialiteProviders\Manager\SocialiteWasCalled::class, 'SocialiteProviders\\Instagram\\InstagramExtendSocialite@handle');

Usage example

  1. Add facebook login button in your login page.
$.request('Login::onSocialiteLogin', {data: {'driver': 'facebook'}});
  1. Create a blank page and attach a component to it.
title = "Facebook auth"
url = "/login/facebook"
is_hidden = 0

[SocialiteLogin]
code = "facebook"
redirect_success_page = "personal-data"
redirect_cancel_page = "login"
==

Component "Logout"

Component properties:

  • Mode (Submit form/Ajax form)
  • Enable redirect
  • Choose page for redirect (the URL of the page will be passed to the user ID)

Usage: The component is used for logout the user. To send an ajax request, you must use the Logout::onAjax method.

**Example 1 (ajax submit)

[Logout]
mode = "ajax"
redirect_on = 1
redirect_page = "index"
==
$.request('Logout::onAjax');

Example 2 (Submit form)

[Logout]
mode = "submit"
redirect_on = 1
redirect_page = "index"
==

Component "ChangePassword"

Component properties:

  • Mode (Submit form/Ajax form)
  • Send flash message (only for Ajax mode)
  • Enable redirect
  • Choose page for redirect (the URL of the page will be passed to the user ID)
  • Enable / disable the old user password

Usage: The component is used to process the user password change form. Required fields are: old_password, password, password_confirmation. To send an ajax request, you must use the ChangePassword::onAjax method.

**Example 1 (ajax submit)

[ChangePassword]
mode = "ajax"
redirect_on = 1
redirect_page = "index"
check_old_password = 1
$('form').request('ChangePassword::onAjax');

Example 2 (Submit form)

[ChangePassword]
mode = "submit"
redirect_on = 1
redirect_page = "index"
check_old_password = 1
==

{% set arError = ChangePassword.getErrorMessage %}

<form href="{{ 'change_password'|page }}">
    
    <label for="field-old-password">Old password</label>
    <input type="password" id="field-old-password" name="old_password">
    
    <label for="field-password">Password</label>
    <input type="password" id="field-password" name="password">
    
    <label for="field-password-confirmation">Password confirmation</label>
    <input type="password" id="field-password-confirmation" name="password_confirmation">
    
    <button type="submit">Submit</button>
</form>
{% if arError.message is not empty %}
    <p>{{ arError.message }}</p>
{% endif %}

The ChangePassword.getOldFormData method returns the filled form fields, if the form was sent and an error occurred. The ChangePassword.getErrorMessage method returns an error message if the form was sent and an error occurred.

[
    'message' => 'Error message',
    'field'   => 'email',           //Field name, if there was a validation error
]

Component "RestorePassword"

Component properties:

  • Mode (Submit form/Ajax form)
  • Send flash message (only for Ajax mode)

Usage: The component is used to process the user password recovery form and send the email. Required fields are: email. To send an ajax request, you must use the RestorePassword::onAjax method.

**Example 1 (ajax submit)

[RestorePassword]
mode = "ajax"
$('form').request('RestorePassword::onAjax');

Example 2 (Submit form)

[RestorePassword]
mode = "submit"
==

{% set arError = RestorePassword.getErrorMessage %}

<form href="{{ 'restore_password'|page }}">
    
    <label for="field-email">Email</label>
    <input type="email" id="field-email" placeholder="Email" name="email" value="{{ arForm.email }}">
    {% if arError.message is not empty and arError.field == 'email' %}
        <p>{{ arError.message }}</p>
    {% endif %}
    
    <button type="submit">Submit</button>
</form>
{% if arError.message is not empty %}
    <p>{{ arError.message }}</p>
{% endif %}

The RestorePassword.getOldFormData method returns the filled form fields, if the form was sent and an error occurred. The RestorePassword.getErrorMessage method returns an error message if the form was sent and an error occurred.

[
    'message' => 'Error message',
    'field'   => 'email',           //Field name, if there was a validation error
]

Event "lovata.buddies::mail.restore.template.data"

You can add additional fields in the email template. By default, the 'lovata.buddies::mail.restore' template is used. To integrate with the Translate plugin, you need to create templates for languages with suffix = language code. For example:

  • 'lovata.buddies::mail.restore' - for default language
  • 'lovata.buddies::mail.restore_ru' - for language with code 'ru'
Event::listen('lovata.buddies::mail.restore.template.data', function($obUser) {
    ...
    
    //Return array with addition fields
    return $arResult;
});

Component "ResetPassword"

Component properties:

  • Mode (Submit form/Ajax form)
  • Send flash message (only for Ajax mode)
  • Enable redirect
  • Choose page for redirect (the URL of the page will be passed to the user ID)

Usage: The component is used to process the user password reset form. Required fields are: password, password_confirmation. To send an ajax request, you must use the ResetPassword::onAjax method.

**Example 1 (ajax submit)

[ResetPassword]
mode = "ajax"
redirect_on = 1
redirect_page = "index"
$('form').request('ResetPassword::onAjax');

Example 2 (Submit form)

[ResetPassword]
mode = "submit"
redirect_on = 1
redirect_page = "index"
==

{% set arError = ResetPassword.getErrorMessage %}

<form href="{{ 'reset_password'|page }}">
    
    <label for="field-password">Password</label>
    <input type="password" id="field-password" name="password">
    
    <label for="field-password-confirmation">Password confirmation</label>
    <input type="password" id="field-password-confirmation" name="password_confirmation">
    
    <button type="submit">Submit</button>
</form>
{% if arError.message is not empty %}
    <p>{{ arError.message }}</p>
{% endif %}

The ResetPassword.getOldFormData method returns the filled form fields, if the form was sent and an error occurred. The ResetPassword.getErrorMessage method returns an error message if the form was sent and an error occurred.

[
    'message' => 'Error message',
    'field'   => 'email',           //Field name, if there was a validation error
]

Component "UserPage"

Component properties:

  • Mode (Submit form/Ajax form)
  • Send flash message (only for Ajax mode)
  • Enable redirect
  • Choose page for redirect (the URL of the page will be passed to the user ID)

Usage: The component is used to process the user data update form. To send an ajax request, you must use the UserPage::onAjax method.

**Example 1 (ajax submit)

[UserPage]
mode = "ajax"
redirect_on = 0
login_page = "login"
$('form').request('UserPage::onAjax');

Example 1 (Submit form).

[UserPage]
mode = "submit"
redirect_on = 1
redirect_page = "user_page"
login_page = "login"
==

{% set arError = UserPage.getErrorMessage %}
{% set arForm = UserPage.getOldFormData %}

<form href="{{ 'user_page'|page }}">
    <label for="field-email">Email</label>
    <input type="email" id="field-email" placeholder="Email" name="email" value="{{ arForm.email }}">
    {% if arError.message is not empty and arError.field == 'email' %}
        <p>{{ arError.message }}</p>
    {% endif %}
    
     <label for="field-company-name">Company name</label>
    <input type="text" id="field-company-name" placeholder="My company" name="property[company_name]" value="{{ arForm.property.company_name }}">
    
    <button type="submit">Submit</button>
</form>
{% if arError.message is not empty %}
    <p>{{ arError.message }}</p>
{% endif %}

The UserPage.getOldFormData method returns the filled form fields, if the form was sent and an error occurred. The UserPage.getErrorMessage method returns an error message if the form was sent and an error occurred.

[
    'message' => 'Error message',
    'field'   => 'email',           //Field name, if there was a validation error
]

Component "UserData"

Usage: The component returns the data of the authorized user. The method "get" returns object of UserItem class.

Example

[UserData]
==

{% set obUser = UserData.get %}

{% if obUser.isNotEmpty %}
<div>
    {{ obUser.name }} {{ obUser.last_name }}
</div>
{% else %}
<div>
    <button>Login</button>
</div>
{% endif %}

UserItem class

The class allows to work with a cached data array of User model.

The UserItem class is extended from ElementItem class.

Field list

  • (int) id
  • (string) email
  • (string) name
  • (string) last_name
  • (string) middle_name
  • (string) phone
  • (array) phone_list
  • (array) property
  • (array) avatar - array with file list (see).

Extending of login query

User::extend(function ($obUser) {
        $obUser->addDynamicMethod('scopeExtendLoginQuery', function ($query, $credential, $value) use ($obUser) {
            if ($credential == 'email') {
                $query = $query->orWhere('login', $value);
            }

            return $query;
        });
    });

oc-buddies-plugin's People

Contributors

alvaro-canepa avatar anik1ng avatar dblackcat avatar dinwid avatar felixinx avatar flusherdock1 avatar gitlog avatar kdzone avatar kharanenka avatar lautsevich avatar norotaro avatar radist avatar ribagek avatar vadimlj avatar vojtasvoboda avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

oc-buddies-plugin's Issues

Showing success message after password change

I've got the following ChangePassword component on change-password.htm page:

[ChangePassword]
slug_required = 0
mode = "submit"
flash_on = 1
redirect_on = 0
check_old_password = 1

After the form is submitted, the user will remain on the same page. Now I want to show a success message to them.

It's possible to check that change password got an error:

{% set arError = ChangePassword.getErrorMessage %}
{% if arError.message is not empty %}
    <p>{{ arError.message }}</p>
{% endif %}

But how to check the operation was successful? I don't won't to put the success message in the else statement because the first time that page loads that message will be shown.

Frontend customer area

Hello I want to understand if there is a reserved area into the frontend for the user to show previous order and to manage personal data and addresses. I didn't find it into shopaholic demo or sneakers theme demo.
Also I think it could be very useful to integrate registration inside checkout flow.
I mean that registration process need to be insert before complete the order.

Plugin Crashes because DataFileModel NOT FOUND

Hi, when I want to use your plugin, I install it. But when I try to open users menu on October CMS, there is an error:

Trait 'Kharanenka\Helper\DataFileModel' not found

on \plugins\lovata\buddies\models\User.php line 65

PLEASE HELP @kharanenka

Login with 'Remember me' checked

return this error:

openssl_encrypt() expects parameter 1 to be string, array given
/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php line 91

system build 464
Buddies 1.8.0

Blog/Forum

Hi

  1. can this be easily used with rainlab blog and forum?
  2. can we have public user page with friends option

Change User Details

Hi there,

is there a way to allow for the front end user to change his details? I have a profile page and I want to give the user the ability to change their details if they want to... is there any way to do this?

getContent error

i m getting this error after placing registration/login component on cms page

Call to a member function getContent() on null" on line 328 of /home3/bikesale/public_html/modules/cms/controllers/Index.php

and following erro message when in browse the login/register page

Class name is not registered for the component "session". Check the component plugin.
/home3/bikesale/public_html/modules/cms/classes/ComponentManager.php line 200

login page

Hi .
I have made a page for users to log in according to the sample you put in the documet like this :

title = "Login"
url = "/signin/:code?"
layout = "inner"
is_hidden = 0
robot_index = "index"
robot_follow = "follow"

[Login]
mode = "submit"
flash_on = 0
redirect_on = 1
redirect_page = "system/profile"

==

{% set arError = Login.getErrorMessage %}
{% set arForm = Login.getOldFormData %}

<form href="{{ 'login'|page }}">
    <label for="field-email">Login</label>
    <input type="email" id="field-email" placeholder="Email" name="email" value="{{ arForm.email }}">
    {% if arError.message is not empty and arError.field == 'email' %}
        <p>{{ arError.message }}</p>
    {% endif %}

    <label for="field-password">Password</label>
    <input type="password" id="field-password" name="password">

    <label for="field-remember_me">Remember me</label>
    <input type="checkbox" id="field-remember_me" name="remember_me">

    <button type="submit">Submit</button>
</form>
{% if arError.message is not empty %}
    <p>{{ arError.message }}</p>
{% endif %}

But when I write the username and password ( even mistake or even when I leave it blank ) it is not redirect to my destination page and no message is given. In any case , the message " You are already authorized. " appears.

Bug with vkontakte authorization

Hi, I see a bug when logging in to VKontakte

When logging in to VKontakte, Buddies does not see the received email and assigns a fake email

Email activation-link loaded via env-var instead config

The Lovata\Buddies\Components\Registration class uses env('SITE_URL') to load the sites URL.
Environment variables are often not set (especially if DotEnv syntax is not used), which results in an unusable Activation Link.

Instead I would suggest to load the url via the configuration: config('app.url').

How to logout using submit?

I don't understand how to logout using submit. I've added to following to the top of the page:

[Logout]
mode = "submit"
redirect_on = 1
redirect_page = "index"
==

Now, what should I do in the onclick of the logout button?

After updating octoberCMS I get the following error

"Class Lovata\Buddies\Classes\Item\UserItem contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (Lovata\Toolbox\Classes\Item\ElementItem::setElementObject, Lovata\Toolbox\Classes\Item\ElementItem::getCacheTag)" on line 28 of /home/user/public_html/plugins/lovata/buddies/classes/item/UserItem.php

Plugin crashes due to lack of DataFileModel class definition on latest October version

Hello,
plugin doesnt work on latest October version

After plugin activation, any attempt to view front site leads to an Exception
Symfony\Component\Debug\Exception\FatalErrorException

We're sorry, but an unhandled error occurred. Please see the details below.
E:\Install\dev\wamp\www\octobersite\plugins\lovata\buddies\models\User.php line 68
~/vendor/october/rain/src/Foundation/Application.php

  • @method static \October\Rain\Database\Relations\HasMany|\Lovata\OrdersShopaholic\Models\UserAddress address()
  • @Property \Lovata\OrdersShopaholic\Classes\Collection\UserAddressCollection|\Lovata\OrdersShopaholic\Classes\Item\UserAddressItem[] $addr
    */
    class User extends UserModel
    {
    use SoftDelete;
    use DataFileModel;

property DataFileModel is undefined

It looks like, there is no class definition for DataFileModel in plugin code

Is there any way to fix this?

Many thanks,
Vlad

getErrorMessage() return empty values with ajax forms

Hello,

I'm working on the user profile edit form. Can make it works without problem on submit form mode, but I need the ajax one. Here is my code :

{% set obUser = UserData.get() %}
{% set arError = UserPage.getErrorMessage %}
{% set arForm = UserPage.getOldFormData %}

{{ d('arForm', arForm) }}
{{ d('arError', arError) }}

<h1>{{ 'Mes informations'|_ }}</h1>
<form onsubmit="changeProfile(this); return false">
    <div class="row">
        <div class="col-md-6 mb-3">
            <div class="form-floating">
                <input type="text" name="name" class="form-control" id="profile-name" placeholder="&nbsp;" value="{{ obUser.name }}" />
                <label for="profile-name">{{ 'Prénom'|_ }}</label>
            </div>
            {% if arError.field == 'name' %}
                <div class="invalid-feedback visible">{{ arError.message }}</div>
            {% endif %}
        </div>
        <div class="col-md-6 mb-3">
            <div class="form-floating">
                <input type="text" name="last_name" class="form-control {% if arError.field == 'last_name' %}is-invalid{% endif %}" id="profile-lastname" placeholder="&nbsp;" value="{{ obUser.last_name }}" />
                <label for="profile-lastname">{{ 'Nom'|_ }}</label>
            </div>
            {% if arError.field == 'last_name' %}
                <div class="invalid-feedback visible">{{ arError.message }}</div>
            {% endif %}
        </div>
        <div class="col-md-12 mb-3">
            <div class="form-floating">
                <input type="text" name="email" class="form-control {% if arError.field == 'email' %}is-invalid{% endif %}" id="profile-email" placeholder="&nbsp;" value="{{ obUser.email }}" />
                <label for="profile-lastname">{{ 'Email'|_ }}</label>
            </div>
            {% if arError.field == 'email' %}
                <div class="invalid-feedback visible">{{ arError.message }}</div>
            {% endif %}
        </div>
        <div class="col-md-6 mb-3">
            <div class="form-floating">
                <input type="text" name="password" class="form-control {% if arError.field == 'password' %}is-invalid{% endif %}" id="profile-password" placeholder="&nbsp;" value="{{ arForm.password }}" />
                <label for="profile-password">{{ 'Mot de passe'|_ }}</label>
            </div>
            {% if arError.field == 'password' %}
                <div class="invalid-feedback visible">{{ arError.message }}</div>
            {% endif %}
        </div>
        <div class="col-md-6 mb-3">
            <div class="form-floating">
                <input type="text" name="password_confirmation" class="form-control {% if arError.field == 'password' %}is-invalid{% endif %}" id="profile-password-confirmation" placeholder="&nbsp;" value="{{ arForm.password_confirmation }}" />
                <label for="profile-password">{{ 'Confirmer le mot de passe'|_ }}</label>
            </div>
            {% if arError.field == 'password_confirmation' %}
                <div class="invalid-feedback visible">{{ arError.message }}</div>
            {% endif %}
        </div>
        <div class="col-md-6">
            <button class="btn btn-primary">{{ 'Valider les changements'|_ }}</button>
        </div>
    </div>
</form>

{% put scripts %}
<script>
    function changeProfile(form) {
        $.request('UserPage::onAjax', {
            form: $(form),
            loading: $.oc.stripeLoadIndicator,
            update: {
                'account/menu':'#menu-wrapper',
                'account/profile':'#content-wrapper'
            },
        });
    }
</script>
{% endput %}

When I submit the form with all data, everything works correctly, but if I submit the form with a problem (for example, empty email address), the {{ arError }} array is still empty (whereas the {{ arForm }} array is correctly updated.

Here is a video that help to understand the problem

https://www.loom.com/share/92870d63dbbe46a59d32a03c4e1b7d3b

Best regards,

Merge develop branch to master

There are 2 commits on develop branch that can be merged to master.
One of them solve issue SQLSTATE[42S02]: Base table or view not found: 1146 Table '{db}.user_groups' doesn't exist (SQL: select count(*) as aggregate from user_groups where code = guest) installing from cli.

[Enhancement] Add login / logout events

I need to do something after the user login / logout (e.g. clear Cart-> user_data).
I suggest adding events: lovata.buddies.login and lovata.buddies.logout.

Event after register

Is there some event called after user register? Something like lovata.buddies.after.login but after register new user.

And exist Event after activate user by backend admin?

Thanks.

Use validationException with ajax forms

Hello,

When I'm working with octoberCMS, I used to use inline field validation with ajax forms triggered with data-attribute API.

I'm discovering buddies, and the whole shopaholic ecosystem, I can't figure out how to make it works. Here is the code of my page.

title = "Inscription"
url = "/inscription"
layout = "default"
is_hidden = 0

[Registration]
mode = "ajax"
flash_on = 1
redirect_on = 1
redirect_page = "compte/connexion"
activation = "activation_on"
force_login = 1
==
{% set arError = Registration.getErrorMessage %}
{% set arForm = Registration.getOldFormData %}

<section id="inscription" class="pb-3 pt-3">
    <div class="container">
        <form data-request="Registration::onAjax" data-request-validate>
            
            <div class="form-floating mb-3">
                <input class="form-control" type="text" id="field-email" name="email" placeholder="&nbsp;" value="{{ arForm.email }}" />
                <label class="form-label" for="field-email">{{ 'Email'|_ }}</label>
                <div class="invalid-feedback" data-validate-for="email"></div>
            </div>
            
            <div class="form-floating mb-3">
                <input class="form-control" type="password" id="field-password" name="password" placeholder="&nbsp;" />
                <label class="form-label" for="field-password">{{ 'Mot de passe'|_ }}</label>
                <div class="invalid-feedback" data-validate-for="password"></div>
            </div>
            
            <div class="form-floating mb-3">
                <input class="form-control" type="password" id="field-password-confirmation" name="password_confirmation" placeholder="&nbsp;" />
                <label class="form-label" for="field-password-confirmation">{{ 'Confirmez le mot de passe'|_ }}</label>
                <div class="invalid-feedback" data-validate-for="password_confirmation"></div>
            </div>

            <button class="btn btn-primary" type="submit">{{ 'Créer un compte'|_ }}</button>
        </form>
    </div>
</section>

I created that issue on Buddies plugin cause I'm testing with registration page first, but I believe it's a more global request as, for what I understood, it rely on Toolbox classes to handle form submission.

So maybe it's a toolbox request, but I think we should be able to use the octobercms way to handle fields error, using data-request-validate on form, and data-validate-for on elements.

Thank you

[Buddies] Add component description to README file

  1. Закончить описание компонентов плагина, часть компонентов я уже описал
  2. В репозиторий с тестовым October добавить страницы для проверки компонентов. Частично эти страницы я уже добавил.

404 page not find error

Hi

I have made a page for User page like this :

title = "profile"
url = "/profile"
layout = "system"
is_hidden = 0
robot_index = "index"
robot_follow = "follow"

[UserPage]
slug = "{{ :slug }}"
slug_required = 1
mode = "submit"
redirect_on = 1
redirect_page = "user_page"

[session]
security = "all"
==
{% set arError = UserPage.getErrorMessage %}
{% set arForm = UserPage.getOldFormData %}

<form href="{{ 'user_page'|page }}">
    <label for="field-email">Email</label>
    <input type="email" id="field-email" placeholder="Email" name="email" value="{{ arForm.email }}">
    {% if arError.message is not empty and arError.field == 'email' %}
    <p>{{ arError.message }}</p>
    {% endif %}

    <label for="field-company-name">Company name</label>
    <input type="text" id="field-company-name" placeholder="My company" name="property[company_name]" value="{{ arForm.property.company_name }}">

    <button type="submit">Submit</button>
</form>
{% if arError.message is not empty %}
<p>{{ arError.message }}</p>
{% endif %}

but its show 404 page not found error after login

add form registration

Hello
I'm trying to use the plugin for friends
I'm trying to include the registration form on a frontend page ... but I do not understand 2 things:

  • the form is not added in the page with the syntax {% component 'Registration' %} ?
  • if I create the form manually(html) which action should the form be associated with?

thanks

UserData on Backend (in own plugin)

Hello, I have a question.
How I get user data in my own plugin?

On frontend is easy:

{% set obUser = UserData.get %}
{{ obUser.email }}

On backend, in my own plugin: I don't know what to do

Thanks

UserPage

Hi

I followed the documentation for the UserPage component and have some questions:

  • how the user data are retrieved in the component?
  • in the example I see I that need to use {{ arForm.email }} for example, but this is empty when I display the userpage after login.

Thanks

Session after registration

Hi,

Assuming I have some items in the cart.

  1. Following a successful login, the items are still in the cart.
  2. Following a registration (without automatic authorization, with user activation) and an immediate login, the cart gets empty.
  3. Following a registration (with automatic authorization, with user activation), the cart gets empty.

Is there a way to keep the items in the cart for cases 2 and 3?

Thanks.

[Buddies] Add password custom validation to function

  1. Вынести повторяющийся код по получению настроек валидации пароля в отдельную функцию модели.
    `
    $iPasswordLengthMin = Settings::getValue('password_limit_min');
    if($iPasswordLengthMin > 0) {
    $arRules['password'] = $arRules['password'].'|min:'.$iPasswordLengthMin;
    }

     $sPasswordRegexp = Settings::getValue('password_regexp');
     if(!empty($sPasswordRegexp)) {
         $arRules['password'] = $arRules['password'].'|regex:%^'.$sPasswordRegexp.'$%';
     }
    

`

User Session Lifetime

Hi,
how to setup session lifetime of user?

Eshop customers have must login several times by day, it is not good.
I need to setup user session lifetime on 7 days.
Is it possible?

Thank you.

Component to check user permission, like "session" with Rainlab.User

Hello,

Coming from the user plugin, there is a component that is really useful and that I don't find with buddies. This is the "session" component, that allow to check for user group and redirect to a specified page if not in that group.

There is something equivalent in the UserPage component, but I think it should be served as a separate component. Sometimes, you want to check for access on another page than the edit profile form.

Maybe it could be the role of the UserData component, not really sure.

What do you think about it ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.