-
Notifications
You must be signed in to change notification settings - Fork 0
Home
GrumpyCrouton edited this page Aug 12, 2022
·
1 revision
This is a module that can be dropped into GF3 to provide login and registration functionality. Integrated using GrumpyPDO, it relies on using a MySQL database.
- Drop into a folder called
authin your GF3 installations modules folder - Set up the
authtable using theauth.sqlfile in the module root - Alter
settings.jsonto your liking
- Registration functionality
- Login functionality
- Stores passwords as hash for security
- Simple form generator to control fields and required fields through the settings file
- Currently limited to regular
inputhtml elements for simplicity, but could be expanded upon
- Currently limited to regular
- Register/Login forms generated from the same base template (
views/form.htm)
- Error box. Used when the server has an issue with a registration or login attempt
- Form field generator
- The example below loops over all of the fields for either the login or registration page to generate the form.
- On each loop, two variables will be set
-
@readable- Readable name of the field. Replaces underscores with spaces and runsucwords(). -
@required- A boolean to easily check if the field is a required one (based on settings)
-
<check if="{{ @GET.error }}">
<div class="ui negative message">
<i class="close icon"></i>
<div class="header">
Error
</div>
<p>{{ @GET.error }}</p>
</div>
</check>
<repeat group="{{ @fields }}" key="{{ @field }}" value="{{ @field_data }}">
<set readable="{{ @field_data->label ?: ucwords(str_replace('_', ' ', @field)) }}"/>
<set required="{{ @field_data->required ?: false }}"/>
<div class="field">
<label>
{{ @readable }}
<check if="{{ @required }}">
{{ '<span class="ui red text">*</span>' }}
</check>
</label>
<input type="{{ @field_data->type }}" name="{{ @field }}" placeholder="{{ @readable }}" {{ @required ? 'required' : '' }}>
</div>
</repeat>


{
"successful_login_path": "default",
"database_columns_for_user_session": ["uid", "username"],
"register_fields": {
"username": {
"type": "text",
"required": true
},
"email": {
"type": "email",
"required": true
},
"password": {
"type": "password",
"required": true
},
"verify_password": {
"type": "password"
}
},
"login_fields": {
"identifier": {
"type": "text",
"label": "Username or Email",
"required": true
},
"password": {
"type": "password",
"required": true
}
}
}