Skip to content

Commit bcd3c77

Browse files
author
Anton
authored
Merge pull request #8 from bluzphp/develop
Updated codestyle
2 parents a1ec342 + e6438d8 commit bcd3c77

File tree

4 files changed

+29
-26
lines changed

4 files changed

+29
-26
lines changed

LICENSE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2012-2017 by Bluz PHP Team
3+
Copyright (c) 2012-2019 by Bluz PHP Team
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+17-11
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,33 @@
11
# Module auth for Bluz Skeleton
22

3-
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/bluzphp/main)
4-
53
### Achievements
64

7-
[![Build Status](https://travis-ci.org/bluzphp/module-auth.svg?branch=master)](https://travis-ci.org/bluzphp/module-auth)
8-
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/bluzphp/module-auth/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/bluzphp/module-auth/?branch=master)
5+
[![PHP >= 7.1+](https://img.shields.io/packagist/php-v/bluzphp/module-auth.svg?style=flat)](https://php.net/)
6+
7+
[![Latest Stable Version](https://img.shields.io/packagist/v/bluzphp/module-auth.svg?label=version&style=flat)](https://packagist.org/packages/bluzphp/module-auth)
8+
9+
[![Build Status](https://img.shields.io/travis/bluzphp/module-auth/master.svg?style=flat)](https://travis-ci.org/bluzphp/module-auth)
10+
11+
[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/bluzphp/module-auth.svg?style=flat)](https://scrutinizer-ci.com/g/bluzphp/module-auth/)
12+
13+
[![Coverage Status](https://img.shields.io/coveralls/bluzphp/module-auth/master.svg?style=flat)](https://coveralls.io/r/bluzphp/module-auth?branch=master)
914

10-
[![Latest Stable Version](https://poser.pugx.org/bluzphp/module-auth/v/stable)](https://packagist.org/packages/bluzphp/module-auth)
11-
[![Total Downloads](https://poser.pugx.org/bluzphp/module-auth/downloads)](https://packagist.org/packages/bluzphp/module-auth)
15+
[![Total Downloads](https://img.shields.io/packagist/dt/bluzphp/module-auth.svg?style=flat)](https://packagist.org/packages/bluzphp/module-auth)
1216

13-
[![License](https://poser.pugx.org/bluzphp/module-auth/license)](https://packagist.org/packages/bluzphp/module-auth)
17+
[![License](https://img.shields.io/packagist/l/bluzphp/module-auth.svg?style=flat)](https://packagist.org/packages/bluzphp/module-auth)
1418

1519
Usage
1620
-------------------------
1721
### Install module
1822
To install the module run the command:
19-
2023

21-
$ composer require bluzphp/module-auth
24+
```bash
25+
php /vendor/bin/bluzman module:install auth
26+
```
2227

2328
### Remove module
2429
To remove the module, run the command:
25-
2630

27-
$ composer remove bluzphp/module-auth
31+
```bash
32+
php /vendor/bin/bluzman module:remove auth
33+
```

application/modules/auth/controllers/auth.php

+9-13
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
* @param string $provider
1515
*
1616
* @return void
17-
* @throws Exception
1817
*/
1918
return function ($provider = '') {
2019
/**
@@ -67,18 +66,15 @@
6766
$authRow->token = $accessToken['access_token'];
6867
$authRow->save();
6968
Response::redirectTo('users', 'profile');
69+
} else if ($authRow) {
70+
// Try to login
71+
$user = Users\Table::findRow($authRow->userId);
72+
Auth\Table::tryLogin($user);
73+
Messages::addNotice('You are signed');
7074
} else {
71-
// Authenticate in the application
72-
if ($authRow) {
73-
// Try to login
74-
$user = Users\Table::findRow($authRow->userId);
75-
Auth\Table::tryLogin($user);
76-
Messages::addNotice('You are signed');
77-
} else {
78-
// User not found
79-
Messages::addError('Not found linked profile');
80-
Response::redirectTo('users', 'signin');
81-
}
75+
// User not found
76+
Messages::addError('Not found linked profile');
77+
Response::redirectTo('users', 'signin');
8278
}
8379

8480
// Disconnect the adapter
@@ -87,5 +83,5 @@
8783
} catch (\Hybridauth\Exception\Exception $e) {
8884
Messages::addError($e->getMessage());
8985
}
90-
Response::redirectTo('index', 'index');
86+
Response::redirectTo('index');
9187
};

composer.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"license": "MIT",
55
"description": "bluz auth module",
66
"require": {
7-
"bluzphp/composer-plugin": "~2.1",
7+
"bluzphp/framework": "~7.11",
8+
"bluzphp/composer-plugin": "~2.3",
89
"hybridauth/hybridauth": "~3.0"
910
}
1011
}

0 commit comments

Comments
 (0)