Merged in os-188-profile-pic (pull request #132)

Os 188 profile pic
This commit is contained in:
Ivan Diaz 2017-02-15 05:53:19 +00:00
commit b25a91b433
74 changed files with 213 additions and 10 deletions

View File

@ -68,7 +68,7 @@
"react-document-title": "^1.0.2", "react-document-title": "^1.0.2",
"react-dom": "^15.0.1", "react-dom": "^15.0.1",
"react-google-recaptcha": "^0.5.2", "react-google-recaptcha": "^0.5.2",
"react-motion": "^0.4.4", "react-motion": "^0.4.7",
"react-redux": "^4.4.5", "react-redux": "^4.4.5",
"react-router": "^2.4.0", "react-router": "^2.4.0",
"react-router-redux": "^4.0.5", "react-router-redux": "^4.0.5",

View File

@ -1,4 +1,6 @@
import React from 'react'; import React from 'react';
import _ from 'lodash';
import {TransitionMotion, spring} from 'react-motion';
import API from 'lib-app/api-call'; import API from 'lib-app/api-call';
import i18n from 'lib-app/i18n'; import i18n from 'lib-app/i18n';
@ -64,12 +66,30 @@ class AdminPanelActivity extends React.Component {
renderList() { renderList() {
return ( return (
<div> <div>
{this.state.activities.map(this.renderRow.bind(this))} <TransitionMotion styles={this.getStyles()} willEnter={this.getEnterStyle.bind(this)}>
{this.renderActivityList.bind(this)}
</TransitionMotion>
{(!this.state.limit) ? this.renderButton() : null} {(!this.state.limit) ? this.renderButton() : null}
</div> </div>
); );
} }
renderActivityList(styles) {
return (
<div>
{styles.map(this.renderAnimatedItem.bind(this))}
</div>
);
}
renderAnimatedItem(config, index) {
return (
<div style={config.style} key={config.key}>
{this.renderRow(config.data, index)}
</div>
);
}
renderButton() { renderButton() {
return ( return (
<SubmitButton type="secondary" onClick={this.retrieveNextPage.bind(this)}> <SubmitButton type="secondary" onClick={this.retrieveNextPage.bind(this)}>
@ -84,6 +104,21 @@ class AdminPanelActivity extends React.Component {
); );
} }
getStyles() {
return this.state.activities.map((item, index) => ({
key: index + '',
data: item,
style: {marginTop: spring(0), opacity: spring(1)}
}));
}
getEnterStyle() {
return {
marginTop: -20,
opacity: 0
};
}
onMenuItemClick(index) { onMenuItemClick(index) {
this.setState({ this.setState({
page: 1, page: 1,

View File

@ -1,5 +1,6 @@
import React from 'react'; import React from 'react';
import _ from 'lodash'; import _ from 'lodash';
import classNames from 'classnames';
import i18n from 'lib-app/i18n'; import i18n from 'lib-app/i18n';
import API from 'lib-app/api-call'; import API from 'lib-app/api-call';
@ -13,6 +14,8 @@ import FormField from 'core-components/form-field';
import SubmitButton from 'core-components/submit-button'; import SubmitButton from 'core-components/submit-button';
import Message from 'core-components/message'; import Message from 'core-components/message';
import Button from 'core-components/button'; import Button from 'core-components/button';
import Icon from 'core-components/icon';
import Loading from 'core-components/loading';
class StaffEditor extends React.Component { class StaffEditor extends React.Component {
static propTypes = { static propTypes = {
@ -32,6 +35,7 @@ class StaffEditor extends React.Component {
email: this.props.email, email: this.props.email,
level: this.props.level - 1, level: this.props.level - 1,
message: null, message: null,
loadingPicture: false,
departments: this.getUserDepartments() departments: this.getUserDepartments()
}; };
@ -67,9 +71,12 @@ class StaffEditor extends React.Component {
</div> </div>
</div> </div>
</div> </div>
<div className="staff-editor__card-pic-wrapper"> <label className={this.getPictureWrapperClass()}>
<div className="staff-editor__card-pic-background"></div>
<img className="staff-editor__card-pic" src={this.props.profilePic} /> <img className="staff-editor__card-pic" src={this.props.profilePic} />
</div> {(this.state.loadingPicture) ? <Loading className="staff-editor__card-pic-loading" size="large"/> : <Icon className="staff-editor__card-pic-icon" name="upload" size="4x"/>}
<input className="staff-editor__image-uploader" type="file" multiple={false} accept="image/x-png,image/gif,image/jpeg" onChange={this.onProfilePicChange.bind(this)}/>
</label>
</div> </div>
</div> </div>
<div className="col-md-8"> <div className="col-md-8">
@ -195,6 +202,15 @@ class StaffEditor extends React.Component {
); );
} }
getPictureWrapperClass() {
let classes = {
'staff-editor__card-pic-wrapper': true,
'staff-editor__card-pic-wrapper_loading': this.state.loadingPicture
};
return classNames(classes);
}
getTicketListProps() { getTicketListProps() {
return { return {
type: 'secondary', type: 'secondary',
@ -282,6 +298,31 @@ class StaffEditor extends React.Component {
this.setState({message: 'FAIL'}); this.setState({message: 'FAIL'});
}); });
} }
onProfilePicChange(event) {
this.setState({
loadingPicture: true
});
API.call({
path: '/staff/edit',
data: {
staffId: this.props.staffId,
file: event.target.files[0]
}
}).then(() => {
this.setState({
loadingPicture: false
});
if(this.props.onChange) {
this.props.onChange();
}
}).catch(() => {
window.scrollTo(0,0);
this.setState({message: 'FAIL', loadingPicture: false});
});
}
} }
export default StaffEditor; export default StaffEditor;

View File

@ -11,13 +11,41 @@
border: 2px solid $grey; border: 2px solid $grey;
margin-bottom: 20px; margin-bottom: 20px;
&__image-uploader {
opacity: 0;
}
&-pic { &-pic {
height: 100%; height: 100%;
position: absolute; position: absolute;
left: 50%; left: 50%;
transform: translate(-50%, 0); transform: translate(-50%, 0);
&-background {
background-color: black;
opacity: 0;
transition: opacity 0.2s ease;
width: 100%;
height: 100%;
position: absolute;
z-index: 10;
}
&-icon {
position: absolute;
color: white;
opacity: 0;
transition: opacity 0.2s ease;
top: 70px;
bottom: 0;
left: 0;
right: 0;
z-index: 11;
}
&-wrapper { &-wrapper {
transition: opacity 0.2s ease;
background-color: $grey;
position: absolute; position: absolute;
top: 20px; top: 20px;
border: 4px solid $grey; border: 4px solid $grey;
@ -28,6 +56,26 @@
text-align: center; text-align: center;
left: 50%; left: 50%;
transform: translate(-50%, 0); transform: translate(-50%, 0);
opacity: 1;
&_loading,
&:hover {
cursor: pointer;
.staff-editor__card-pic-background {
opacity: 0.6;
}
.staff-editor__card-pic-icon {
opacity: 0.8;
}
.staff-editor__card-pic-loading {
position: absolute;
top: 0;
z-index: 11;
}
}
} }
} }

View File

@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true);
class AddTopicController extends Controller { class AddTopicController extends Controller {
const PATH = '/add-topic'; const PATH = '/add-topic';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true);
class AddArticleController extends Controller { class AddArticleController extends Controller {
const PATH = '/add'; const PATH = '/add';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true);
class DeleteTopicController extends Controller { class DeleteTopicController extends Controller {
const PATH = '/delete-topic'; const PATH = '/delete-topic';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true);
class DeleteArticleController extends Controller { class DeleteArticleController extends Controller {
const PATH = '/delete'; const PATH = '/delete';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true);
class EditTopicController extends Controller { class EditTopicController extends Controller {
const PATH = '/edit-topic'; const PATH = '/edit-topic';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true);
class EditArticleController extends Controller { class EditArticleController extends Controller {
const PATH = '/edit'; const PATH = '/edit';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true);
class GetAllArticlesController extends Controller { class GetAllArticlesController extends Controller {
const PATH = '/get-all'; const PATH = '/get-all';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true);
class AddStaffController extends Controller { class AddStaffController extends Controller {
const PATH = '/add'; const PATH = '/add';
const METHOD = 'POST';
private $name; private $name;
private $email; private $email;

View File

@ -4,6 +4,8 @@ DataValidator::with('CustomValidations', true);
class AssignStaffController extends Controller { class AssignStaffController extends Controller {
const PATH = '/assign-ticket'; const PATH = '/assign-ticket';
const METHOD = 'POST';
private $ticket; private $ticket;
private $user; private $user;

View File

@ -6,6 +6,7 @@ DataValidator::with('CustomValidations', true);
class DeleteStaffController extends Controller { class DeleteStaffController extends Controller {
const PATH = '/delete'; const PATH = '/delete';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator;
class EditStaffController extends Controller { class EditStaffController extends Controller {
const PATH = '/edit'; const PATH = '/edit';
const METHOD = 'POST';
private $staffInstance; private $staffInstance;
@ -56,6 +57,11 @@ class EditStaffController extends Controller {
$this->staffInstance->sharedDepartmentList = $this->getDepartmentList(); $this->staffInstance->sharedDepartmentList = $this->getDepartmentList();
} }
if(Controller::request('file')) {
$fileUploader = $this->uploadFile();
$this->staffInstance->profilePic = ($fileUploader instanceof FileUploader) ? $fileUploader->getFileName() : null;
}
$this->staffInstance->store(); $this->staffInstance->store();
} }

View File

@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator;
class GetAllTicketsStaffController extends Controller { class GetAllTicketsStaffController extends Controller {
const PATH = '/get-all-tickets'; const PATH = '/get-all-tickets';
const METHOD = 'POST';
public function validations() { public function validations() {
return[ return[

View File

@ -4,6 +4,7 @@ use Respect\Validation\Validator as DataValidator;
class GetAllStaffController extends Controller { class GetAllStaffController extends Controller {
const PATH ='/get-all'; const PATH ='/get-all';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator;
class GetNewTicketsStaffController extends Controller { class GetNewTicketsStaffController extends Controller {
const PATH = '/get-new-tickets'; const PATH = '/get-new-tickets';
const METHOD = 'POST';
public function validations() { public function validations() {
return[ return[

View File

@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator;
class GetTicketStaffController extends Controller { class GetTicketStaffController extends Controller {
const PATH = '/get-tickets'; const PATH = '/get-tickets';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true);
class GetStaffController extends Controller { class GetStaffController extends Controller {
const PATH = '/get'; const PATH = '/get';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator;
class LastEventsStaffController extends Controller { class LastEventsStaffController extends Controller {
const PATH = '/last-events'; const PATH = '/last-events';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator;
class SearchTicketStaffController extends Controller { class SearchTicketStaffController extends Controller {
const PATH = '/search-tickets'; const PATH = '/search-tickets';
const METHOD = 'POST';
public function validations() { public function validations() {
return[ return[

View File

@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true);
class UnAssignStaffController extends Controller { class UnAssignStaffController extends Controller {
const PATH = '/un-assign-ticket'; const PATH = '/un-assign-ticket';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator;
class AddAPIKeyController extends Controller { class AddAPIKeyController extends Controller {
const PATH = '/add-api-key'; const PATH = '/add-api-key';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator;
class AddDepartmentController extends Controller { class AddDepartmentController extends Controller {
const PATH = '/add-department'; const PATH = '/add-department';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -3,6 +3,7 @@ use Ifsnop\Mysqldump as IMysqldump;
class BackupDatabaseController extends Controller { class BackupDatabaseController extends Controller {
const PATH = '/backup-database'; const PATH = '/backup-database';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -2,6 +2,7 @@
class CSVImportController extends Controller { class CSVImportController extends Controller {
const PATH = '/csv-import'; const PATH = '/csv-import';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -3,6 +3,7 @@ use RedBeanPHP\Facade as RedBean;
class DeleteAllUsersController extends Controller { class DeleteAllUsersController extends Controller {
const PATH = '/delete-all-users'; const PATH = '/delete-all-users';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator;
class DeleteAPIKeyController extends Controller { class DeleteAPIKeyController extends Controller {
const PATH = '/delete-api-key'; const PATH = '/delete-api-key';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true);
class DeleteDepartmentController extends Controller { class DeleteDepartmentController extends Controller {
const PATH = '/delete-department'; const PATH = '/delete-department';
const METHOD = 'POST';
private $departmentId; private $departmentId;
private $transferDepartmentId; private $transferDepartmentId;

View File

@ -2,6 +2,7 @@
class DisableRegistrationController extends Controller { class DisableRegistrationController extends Controller {
const PATH = '/disable-registration'; const PATH = '/disable-registration';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -2,6 +2,7 @@
class DisableUserSystemController extends Controller { class DisableUserSystemController extends Controller {
const PATH = '/disable-user-system'; const PATH = '/disable-user-system';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -4,6 +4,7 @@ use Respect\Validation\Validator as DataValidator;
class DownloadController extends Controller { class DownloadController extends Controller {
const PATH = '/download'; const PATH = '/download';
const METHOD = 'GET';
public function validations() { public function validations() {
return [ return [

View File

@ -5,6 +5,7 @@ DataValidator::with('CustomValidations', true);
class EditDepartmentController extends Controller { class EditDepartmentController extends Controller {
const PATH = '/edit-department'; const PATH = '/edit-department';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator;
class EditMailTemplateController extends Controller { class EditMailTemplateController extends Controller {
const PATH = '/edit-mail-template'; const PATH = '/edit-mail-template';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -2,6 +2,7 @@
class EditSettingsController extends Controller { class EditSettingsController extends Controller {
const PATH = '/edit-settings'; const PATH = '/edit-settings';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator;
class EnableRegistrationController extends Controller { class EnableRegistrationController extends Controller {
const PATH = '/enable-registration'; const PATH = '/enable-registration';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -2,6 +2,7 @@
class EnabledUserSystemController extends Controller { class EnabledUserSystemController extends Controller {
const PATH = '/enabled-user-system'; const PATH = '/enabled-user-system';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator;
class GetAllKeyController extends Controller { class GetAllKeyController extends Controller {
const PATH = '/get-all-keys'; const PATH = '/get-all-keys';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator;
class GetLogsController extends Controller { class GetLogsController extends Controller {
const PATH = '/get-logs'; const PATH = '/get-logs';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator;
class GetMailTemplatesController extends Controller { class GetMailTemplatesController extends Controller {
const PATH = '/get-mail-templates'; const PATH = '/get-mail-templates';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -2,6 +2,7 @@
class GetSettingsController extends Controller { class GetSettingsController extends Controller {
const PATH = '/get-settings'; const PATH = '/get-settings';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator;
class GetStatsController extends Controller { class GetStatsController extends Controller {
const PATH = '/get-stats'; const PATH = '/get-stats';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -2,6 +2,7 @@
class InitSettingsController extends Controller { class InitSettingsController extends Controller {
const PATH = '/init-settings'; const PATH = '/init-settings';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator;
class RecoverMailTemplateController extends Controller { class RecoverMailTemplateController extends Controller {
const PATH = '/recover-mail-template'; const PATH = '/recover-mail-template';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true);
class AddCustomResponseController extends Controller { class AddCustomResponseController extends Controller {
const PATH = '/add-custom-response'; const PATH = '/add-custom-response';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true);
class ChangeDepartmentController extends Controller { class ChangeDepartmentController extends Controller {
const PATH = '/change-department'; const PATH = '/change-department';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator;
class ChangePriorityController extends Controller { class ChangePriorityController extends Controller {
const PATH = '/change-priority'; const PATH = '/change-priority';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true);
class CloseController extends Controller { class CloseController extends Controller {
const PATH = '/close'; const PATH = '/close';
const METHOD = 'POST';
private $ticket; private $ticket;

View File

@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true);
class CommentController extends Controller { class CommentController extends Controller {
const PATH = '/comment'; const PATH = '/comment';
const METHOD = 'POST';
private $ticket; private $ticket;
private $content; private $content;

View File

@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true);
class CreateController extends Controller { class CreateController extends Controller {
const PATH = '/create'; const PATH = '/create';
const METHOD = 'POST';
private $title; private $title;
private $content; private $content;

View File

@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true);
class DeleteCustomResponseController extends Controller { class DeleteCustomResponseController extends Controller {
const PATH = '/delete-custom-response'; const PATH = '/delete-custom-response';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true);
class EditCustomResponseController extends Controller { class EditCustomResponseController extends Controller {
const PATH = '/edit-custom-response'; const PATH = '/edit-custom-response';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true);
class GetCustomResponsesController extends Controller { class GetCustomResponsesController extends Controller {
const PATH = '/get-custom-responses'; const PATH = '/get-custom-responses';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true);
class TicketGetController extends Controller { class TicketGetController extends Controller {
const PATH = '/get'; const PATH = '/get';
const METHOD = 'POST';
private $ticket; private $ticket;

View File

@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator;
class ReOpenController extends Controller { class ReOpenController extends Controller {
const PATH = '/re-open'; const PATH = '/re-open';
const METHOD = 'POST';
private $ticket; private $ticket;

View File

@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator;
class SeenController extends Controller { class SeenController extends Controller {
const PATH = '/seen'; const PATH = '/seen';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator;
class BanUserController extends Controller { class BanUserController extends Controller {
const PATH = '/ban'; const PATH = '/ban';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -2,6 +2,7 @@
class CheckSessionController extends Controller { class CheckSessionController extends Controller {
const PATH = '/check-session'; const PATH = '/check-session';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -6,6 +6,7 @@ DataValidator::with('CustomValidations', true);
class DeleteUserController extends Controller { class DeleteUserController extends Controller {
const PATH = '/delete'; const PATH = '/delete';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator;
class EditEmail extends Controller{ class EditEmail extends Controller{
const PATH = '/edit-email'; const PATH = '/edit-email';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator;
class EditPassword extends Controller { class EditPassword extends Controller {
const PATH = '/edit-password'; const PATH = '/edit-password';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true);
class GetUserByIdController extends Controller { class GetUserByIdController extends Controller {
const PATH = '/get-user'; const PATH = '/get-user';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator;
class GetUsersController extends Controller { class GetUsersController extends Controller {
const PATH = '/get-users'; const PATH = '/get-users';
const METHOD = 'POST';
public function validations() { public function validations() {
return[ return[

View File

@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true);
class GetUserController extends Controller { class GetUserController extends Controller {
const PATH = '/get'; const PATH = '/get';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator;
class ListBanUserController extends Controller { class ListBanUserController extends Controller {
const PATH = '/list-ban'; const PATH = '/list-ban';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -2,6 +2,7 @@
class LoginController extends Controller { class LoginController extends Controller {
const PATH = '/login'; const PATH = '/login';
const METHOD = 'POST';
private $userInstance; private $userInstance;
private $rememberToken; private $rememberToken;
@ -40,7 +41,7 @@ class LoginController extends Controller {
Response::respondSuccess($this->getUserData()); Response::respondSuccess($this->getUserData());
} else { } else {
Response::respondError(ERRORS::INVALID_CREDENTIALS); Response::respondError(Controller::request('email'));
} }
} }

View File

@ -1,6 +1,7 @@
<?php <?php
class LogoutController extends Controller { class LogoutController extends Controller {
const PATH = '/logout'; const PATH = '/logout';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true);
class RecoverPasswordController extends Controller { class RecoverPasswordController extends Controller {
const PATH = '/recover-password'; const PATH = '/recover-password';
const METHOD = 'POST';
private $email; private $email;
private $token; private $token;

View File

@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true);
class SendRecoverPasswordController extends Controller { class SendRecoverPasswordController extends Controller {
const PATH = '/send-recover-password'; const PATH = '/send-recover-password';
const METHOD = 'POST';
private $token; private $token;
private $user; private $user;

View File

@ -5,6 +5,7 @@ DataValidator::with('CustomValidations', true);
class SignUpController extends Controller { class SignUpController extends Controller {
const PATH = '/signup'; const PATH = '/signup';
const METHOD = 'POST';
private $userEmail; private $userEmail;
private $userName; private $userName;

View File

@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator;
class UnBanUserController extends Controller { class UnBanUserController extends Controller {
const PATH = '/un-ban'; const PATH = '/un-ban';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator;
class VerifyController extends Controller{ class VerifyController extends Controller{
const PATH = '/verify'; const PATH = '/verify';
const METHOD = 'POST';
public function validations() { public function validations() {
return [ return [

View File

@ -17,7 +17,11 @@ class ControllerGroup {
$app->group($this->groupPath, function () use ($app, $controllers) { $app->group($this->groupPath, function () use ($app, $controllers) {
foreach ($controllers as $controller) { foreach ($controllers as $controller) {
$app->post($controller::PATH, $controller->getHandler()); if($controller::METHOD === 'POST') {
$app->post($controller::PATH, $controller->getHandler());
} else {
$app->get($controller::PATH, $controller->getHandler());
}
} }
}); });
} }