-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
users: create user record on registration
* Creates a user record when a new account is registered. * Disables `invenio-userprofiles` module. * Exposes and uses user record for displaying user information in templates. * Gives role `user` by default when a new record is created. * Removes `organisation` from required fields for users. * Hides `applications` and `security` menu entries. * Creates a new page for editing user data. * Removes useless CSS rules * Adds CSS rules for standalone editor. * Customizes settings page. Co-Authored-by: Sébastien Délèze <[email protected]>
- Loading branch information
Sébastien Délèze
committed
Jun 18, 2020
1 parent
d9b6761
commit 804ca2f
Showing
22 changed files
with
267 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -142,7 +142,6 @@ | |
"full_name", | ||
"email", | ||
"roles", | ||
"organisation", | ||
"$schema" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# Swiss Open Access Repository | ||
# Copyright (C) 2019 RERO | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as published by | ||
# the Free Software Foundation, version 3 of the License. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
"""Signals for users.""" | ||
|
||
from sonar.modules.users.api import UserRecord, datastore | ||
|
||
|
||
def user_registered_handler(app, user, confirm_token): | ||
"""Called when a new user is registered. | ||
:param app: App context. | ||
:param user: User account. | ||
""" | ||
# Add a default role to user | ||
role = datastore.find_role(UserRecord.ROLE_USER) | ||
datastore.add_role_to_user(user, role) | ||
datastore.commit() | ||
|
||
# Create user record | ||
user_record = UserRecord.get_user_by_email(user.email) | ||
if not user_record: | ||
user_record = UserRecord.create( | ||
{ | ||
'full_name': user.email, | ||
'email': user.email, | ||
'roles': [UserRecord.ROLE_USER] | ||
}, | ||
dbcommit=True) | ||
user_record.reindex() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{# -*- coding: utf-8 -*- | ||
Swiss Open Access Repository | ||
Copyright (C) 2019 RERO | ||
|
||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, version 3 of the License. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
|
||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
#} | ||
|
||
{% extends 'sonar/page_settings.html' %} | ||
|
||
{%- block settings_body scoped %} | ||
<div class="standalone-editor"> | ||
<sonar-root></sonar-root> | ||
</div> | ||
{%- endblock settings_body %} | ||
|
||
{%- block javascript %} | ||
<script src="/static/sonar-ui/runtime.js?{{ ui_version }}"></script> | ||
<script src="/static/sonar-ui/polyfills.js?{{ ui_version }}"></script> | ||
<script src="/static/sonar-ui/main.js?{{ ui_version }}"></script> | ||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" | ||
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" | ||
integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script> | ||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" | ||
integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script> | ||
{%- endblock javascript %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ msgid "" | |
msgstr "" | ||
"Project-Id-Version: sonar 0.4.0\n" | ||
"Report-Msgid-Bugs-To: [email protected]\n" | ||
"POT-Creation-Date: 2020-06-05 10:30+0200\n" | ||
"POT-Creation-Date: 2020-06-05 10:32+0200\n" | ||
"PO-Revision-Date: 2020-05-13 05:58+0000\n" | ||
"Last-Translator: Nicolas Prongué <[email protected]>, 2020\n" | ||
"Language: de\n" | ||
|
@@ -20,6 +20,10 @@ msgstr "" | |
"Content-Transfer-Encoding: 8bit\n" | ||
"Generated-By: Babel 2.8.0\n" | ||
|
||
#, python-format | ||
msgid "%(icon)s Profile" | ||
msgstr "" | ||
|
||
msgid "Abstract" | ||
msgstr "" | ||
|
||
|
@@ -514,9 +518,6 @@ msgstr "" | |
msgid "Series to which belongs the resource." | ||
msgstr "" | ||
|
||
msgid "Settings" | ||
msgstr "" | ||
|
||
msgid "Sign Up" | ||
msgstr "" | ||
|
||
|
@@ -2747,3 +2748,6 @@ msgstr "" | |
msgid "vol." | ||
msgstr "" | ||
|
||
#~ msgid "Settings" | ||
#~ msgstr "" | ||
|
Oops, something went wrong.