# Module: authController

## authController

login controller

Author:
  - Yaw Joseph Etse
Copyright:
  - Copyright (c) 2014 Typesettin. All rights reserved.
License:
  - MIT
Source:
  - controller/auth.js, line 168

### Requires

- module:passport
- module:path
- module:passport-local
- module:passport-facebook
- module:fs-extra
- module:periodicjs.core.utilities
- module:periodicjs.core.controller
- module:periodicjs.core.extensions

### Methods

#### <inner> ensureAuthenticated(req, res) → {function}

  make sure a user is authenticated, if not logged in, send them to login page and return them to original resource after login

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `req` | object |
  `res` | object |

  Source:
    - controller/auth.js, line 96

  ##### Returns:

  next() callback

  Type
    function

#### <inner> login(req, res) → {object}

  logins a user using passport's local strategy, if a user is passed to this function, then the user will be logged in and req.user will be populated

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `req` | object |
  `res` | object |

  Source:
    - controller/auth.js, line 23

  ##### Returns:

  reponds with an error page or sends user to authenicated in resource

  Type
    object

#### <inner> logout(req, res) → {object}

  logs user out and destroys user session

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `req` | object |
  `res` | object |

  Source:
    - controller/auth.js, line 60

  ##### Returns:

  sends user to logout resource

  Type
    object

#### <inner> rememberme(req, res) → {function}

  keep a user logged in for 30 days

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `req` | object |
  `res` | object |

  Source:
    - controller/auth.js, line 76

  ##### Returns:

  next() callback

  Type
    function