diff --git a/docs/administration/index.rst b/docs/administration/index.rst index f9cf293b..9dd94952 100644 --- a/docs/administration/index.rst +++ b/docs/administration/index.rst @@ -262,11 +262,18 @@ for those plugins. Authentication -------------- -Lemur currently supports Basic Authentication and Ping OAuth2 out of the box. Additional flows can be added relatively easily. -If you are not using Ping you do not need to configure any of these options. +Lemur currently supports Basic Authentication, Ping OAuth2, and Google out of the box. Additional flows can be added relatively easily. +If you are not using an authentication provider you do not need to configure any of these options. For more information about how to use social logins, see: `Satellizer `_ +.. data:: ACTIVE_PROVIDERS + :noindex: + + :: + + ACTIVE_PROVIDERS = ["ping", "google"] + .. data:: PING_SECRET :noindex: @@ -296,6 +303,33 @@ For more information about how to use social logins, see: `Satellizer
-
diff --git a/lemur/static/app/angular/authentication/services.js b/lemur/static/app/angular/authentication/services.js index dddffeb4..7719b444 100644 --- a/lemur/static/app/angular/authentication/services.js +++ b/lemur/static/app/angular/authentication/services.js @@ -6,6 +6,10 @@ angular.module('lemur') .service('AuthenticationService', function ($location, $rootScope, AuthenticationApi, UserService, toaster, $auth) { var AuthenticationService = this; + AuthenticationService.get_providers = function () { + return AuthenticationApi.one('providers').get(); + }; + AuthenticationService.login = function (username, password) { AuthenticationApi.customPOST({'username': username, 'password': password}, 'login') .then( diff --git a/lemur/static/app/angular/users/user/user.tpl.html b/lemur/static/app/angular/users/user/user.tpl.html index c2e9687b..b19750b1 100644 --- a/lemur/static/app/angular/users/user/user.tpl.html +++ b/lemur/static/app/angular/users/user/user.tpl.html @@ -30,8 +30,7 @@ Password
- -

You must enter an password

+
diff --git a/lemur/users/models.py b/lemur/users/models.py index a3a13b1e..3a272d98 100644 --- a/lemur/users/models.py +++ b/lemur/users/models.py @@ -52,7 +52,10 @@ class User(db.Model): :param password: :return: """ - return bcrypt.check_password_hash(self.password, password) + if self.password: + return bcrypt.check_password_hash(self.password, password) + else: + return False def hash_password(self): """ @@ -60,8 +63,11 @@ class User(db.Model): :return: """ - self.password = bcrypt.generate_password_hash(self.password) - return self.password + if self.password: + self.password = bcrypt.generate_password_hash(self.password) + return self.password + else: + return None @property def is_admin(self): diff --git a/lemur/users/views.py b/lemur/users/views.py index 548caaeb..85093997 100644 --- a/lemur/users/views.py +++ b/lemur/users/views.py @@ -157,7 +157,7 @@ class UsersList(AuthenticatedResource): """ self.reqparse.add_argument('username', type=str, location='json', required=True) self.reqparse.add_argument('email', type=str, location='json', required=True) - self.reqparse.add_argument('password', type=str, location='json', required=True) + self.reqparse.add_argument('password', type=str, location='json', default=None) self.reqparse.add_argument('active', type=bool, default=True, location='json') self.reqparse.add_argument('roles', type=roles, default=[], location='json')