2017 © Pedro Peláez
 

october-plugin oc-codelogin-plugin

image

vojtasvoboda/oc-codelogin-plugin

  • Thursday, April 5, 2018
  • by VojtaSvoboda
  • Repository
  • 3 Watchers
  • 4 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

Code Login for OctoberCMS

Codacy Scrutinizer Coverage License, (*1)

Login only by code or password. Create secret page or protect whole site just in minute. Tested with the latest stable OctoberCMS build 349., (*2)

Dependencies

RainLab.User plugin for users management., (*3)

How to create secret page

0) Install RainLab.User plugin and then VojtaSvoboda.CodeLogin plugin., (*4)

1) Insert RainLab.User Session component to layout which you want to protect by code., (*5)

Screenshot of Session component placed at layout , (*6)

Set Allow property only for Users (means logged users) and then set your login page. All guests will be redirect to login page., (*7)

Be sure you have injected JavaScript code and jQuery to your layout:, (*8)



{% framework %}
{% framework extras %}

Framework extras tag is optional and this tag adds a CSS and JavaScript files that contain the loading indicator plugin and CSS classes for styling the loading indicator. The indicator is displayed on the top of the page when an AJAX request runs., (*9)

2) Create login page with Login layout and insert RainLab.User Session component and Code login form. Session component set to Allow only guest (login allowed only for guests). CodeLogin provide login form and session component will redirect user when already logged., (*10)

Screenshot of Login page with Session and Code login form , (*11)

Set redirect parameter to your secret page and then set if you want to use input type text or input type password (code will not be visible)., (*12)

Screenshot of Login form with visible password , (*13)

3) Use default HTML or create own design by extending component template:, (*14)

  • create file /partials/codeLogin/default.htm
  • copy content from original component template /components/codelogin/default.htm
  • add classes or HTML you needed

Screenshot of custom designs , (*15)

4) At RainLab.User plugin create as many users as you want. It's recommanded to use unique password for each user, because first user with matched password will be log!, (*16)

5) [optional] If you want create logout page, just create logout.htm, insert session component allowed for logged user and with redirect to login page. To the template paste this code:, (*17)

<a data-request="onLogout" class="btn" data-request-data="redirect: '/login'">Sign out</a>, (*18)

6) [optional] For logging all user accesses use UserAccessLog plugin., (*19)

7) [optional] For creating more user accounts use User import/export plugin - just create simple XLS file with usernames and import it (passwords can be generated by Norton Password Generator)., (*20)

Events

After successfull login you can use rainlab.user.login event to catch logged user instance:, (*21)

Event::listen('rainlab.user.login', function ($user) {
    dump($user);
});

Troubleshooting

Login button doesn't works.

Be sure you have included jQuery and {% framework extras %} code to your layout (not to page)., (*22)

AJAX handler 'codeLogin::onCodesignin' was not found.

If form doesn't work, try to insert Code login component to page, not to partial. Login component should be placed beside to Session component., (*23)

Future plans

  • [ ] can change login form input field text
  • [ ] code preset with GET parameter e.g. /login?code=abcde
  • [ ] unit test for logging method

Feel free to send pullrequest!, (*24)

License

Code login plugin is open-sourced software licensed under the MIT license same as OctoberCMS platform., (*25)

Contributing

Please send Pull Request to master branch., (*26)

The Versions

05/04 2018

1.0.1

1.0.1.0

  Sources   Download

21/01 2018

dev-master

9999999-dev https://github.com/vojtasvoboda/oc-codelogin-plugin

Code login plugin for OctoberCMS

  Sources   Download

MIT

The Requires

 

by Vojta Svoboda

plugin user code login october

09/05 2017

1.0.5

1.0.5.0 https://github.com/vojtasvoboda/oc-codelogin-plugin

Code login plugin for OctoberCMS

  Sources   Download

MIT

The Requires

 

by Vojta Svoboda

plugin user code login october

14/07 2016

1.0.4

1.0.4.0 https://github.com/vojtasvoboda/oc-codelogin-plugin

Code login plugin for OctoberCMS

  Sources   Download

MIT

The Requires

 

by Vojta Svoboda

plugin user code login october

20/04 2016

1.0.3

1.0.3.0 https://github.com/vojtasvoboda/oc-codelogin-plugin

Code login plugin for OctoberCMS

  Sources   Download

MIT

The Requires

  • php >=5.5.9

 

by Vojta Svoboda

plugin user code login october

01/04 2016

1.0.2

1.0.2.0 https://github.com/vojtasvoboda/oc-codelogin-plugin

Code login plugin for OctoberCMS

  Sources   Download

MIT

The Requires

  • php >=5.5.9

 

by Vojta Svoboda

plugin user code login october