Fixed minor issues

This commit is contained in:
thosakwe 2016-12-22 12:24:01 -05:00
parent 3e81778155
commit ee72bf748c
3 changed files with 7 additions and 9 deletions

View file

@ -1,6 +1,6 @@
# angel_auth
[![version 1.1.0-dev+15](https://img.shields.io/badge/version-1.1.0--dev+15-red.svg)](https://pub.dartlang.org/packages/angel_auth)
[![version 1.1.0-dev+16](https://img.shields.io/badge/version-1.1.0--dev+16-red.svg)](https://pub.dartlang.org/packages/angel_auth)
![build status](https://travis-ci.org/angel-dart/auth.svg?branch=master)
A complete authentication plugin for Angel. Inspired by Passport.

View file

@ -238,22 +238,20 @@ class AngelAuth extends AngelPlugin {
..inject(AuthToken, req.properties['token'] = token)
..inject(result.runtimeType, req.properties["user"] = result);
if (allowCookie) req.cookies.add(new Cookie("token", jwt));
if (allowCookie) res.cookies.add(new Cookie("token", jwt));
if (options?.callback != null) {
return await options.callback(req, res, jwt);
}
if (options?.canRespondWithJson != false &&
if (options?.successRedirect?.isNotEmpty == true) {
return res.redirect(options.successRedirect, code: HttpStatus.OK);
} else if (options?.canRespondWithJson != false &&
req.headers.value("accept") != null &&
(req.headers.value("accept").contains("application/json") ||
req.headers.value("accept").contains("*/*") ||
req.headers.value("accept").contains("application/*"))) {
return {"data": result, "token": jwt};
} else if (options != null &&
options.successRedirect != null &&
options.successRedirect.isNotEmpty) {
return res.redirect(options.successRedirect, code: HttpStatus.OK);
}
return true;
@ -281,7 +279,7 @@ class AngelAuth extends AngelPlugin {
}
}
req.cookies.removeWhere((cookie) => cookie.name == "token");
res.cookies.removeWhere((cookie) => cookie.name == "token");
if (options != null &&
options.successRedirect != null &&

View file

@ -1,6 +1,6 @@
name: angel_auth
description: A complete authentication plugin for Angel.
version: 1.0.0-dev+15
version: 1.0.0-dev+16
author: Tobe O <thosakwe@gmail.com>
homepage: https://github.com/angel-dart/angel_auth
dependencies: