Use medigram authentication module rather than an external script

The Medigram authentication module makes use of Omg access the mongodb
database and authenticate the user.

BugzID: 35