-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Fullname and Nickname Feature to User Profiles #2575
base: develop
Are you sure you want to change the base?
Changes from all commits
4e9f830
2716bd3
cee3269
d6ffaf8
795f612
f63cdf3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,7 +81,6 @@ def create_app(name="", imprint=None, gdpr=None): | |
|
||
@APP.route('/xstatic/<name>/<path:filename>') | ||
def files(name, filename): | ||
|
||
base_path = _xstatic(name) | ||
if base_path is None: | ||
abort(404) | ||
|
@@ -96,10 +95,6 @@ def mss_theme(filename): | |
|
||
APP.jinja_env.globals.update(get_topmenu=get_topmenu) | ||
|
||
@APP.route("/index") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. have you moved this? or why is it deleted? http://localhost:8083/ seems broken. |
||
def index(): | ||
return render_template("/index.html") | ||
|
||
@APP.route("/mss/about") | ||
@APP.route("/mss") | ||
def about(): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,9 +64,10 @@ class User(db.Model): | |
confirmed_on = db.Column(AwareDateTime, nullable=True) | ||
permissions = db.relationship('Permission', cascade='all,delete,delete-orphan', backref='user') | ||
authentication_backend = db.Column(db.String(255), nullable=False, default='local') | ||
fullname = db.Column(db.String(255), nullable=True) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. because you change the dbase model, you need to do additional steps, see when that is not done, a also it may be useful to change the seed.py to add some of this data. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i have generated the migration script but while applying it to database i am facing import error. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please show the failure There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please show your PYTHONPATH There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. likly PYTHONPATH should show D:\LOCAL_CODE COPY\MSS I think on windows you can use currently python can't find mslib. ... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
def __init__(self, emailid, username, password, profile_image_path=None, confirmed=False, | ||
confirmed_on=None, authentication_backend='local'): | ||
confirmed_on=None, authentication_backend='local', fullname=""): | ||
self.username = str(username) | ||
self.emailid = str(emailid) | ||
self.hash_password(password) | ||
|
@@ -75,6 +76,7 @@ def __init__(self, emailid, username, password, profile_image_path=None, confirm | |
self.confirmed = bool(confirmed) | ||
self.confirmed_on = confirmed_on | ||
self.authentication_backend = str(authentication_backend) | ||
self.fullname = str(fullname) | ||
|
||
def __repr__(self): | ||
return f'<User {self.username}>' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -966,6 +966,31 @@ def delete_account(self, _=None): | |
if r.status_code == 200 and json.loads(r.text)["success"] is True: | ||
self.logout() | ||
|
||
@verify_user_token | ||
def editfull_name(self): | ||
fullname, ok = QtWidgets.QInputDialog.getText( | ||
self.ui, | ||
self.ui.tr("Edit Full Name"), | ||
self.ui.tr("Enter new full name:") | ||
) | ||
|
||
if ok: | ||
data = { | ||
"token": self.token, | ||
"fullname": str(fullname) | ||
} | ||
url = urljoin(self.mscolab_server_url, 'edit_full_name') | ||
r = requests.post(url, data=data) | ||
|
||
if r.text == "true": | ||
self.error_dialog = QtWidgets.QErrorMessage() | ||
self.error_dialog.showMessage("Fullname is updated successfully.") | ||
self.profile_dialog.fullname_label2.setText(self.user["fullname"]) | ||
|
||
|
||
def editnick_name(self): | ||
pass | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is currently a stub, or? |
||
|
||
@verify_user_token | ||
def add_operation_handler(self, _=None): | ||
def check_and_enable_operation_accept(): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,66 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# Form implementation generated from reading ui file 'mslib/msui/ui/ui_add_user.ui' | ||
# Form implementation generated from reading ui file 'ui_add_user_dialog.ui' | ||
# | ||
# Created by: PyQt5 UI code generator 5.9.2 | ||
# Created by: PyQt5 UI code generator 5.15.9 | ||
# | ||
# WARNING! All changes made in this file will be lost! | ||
# WARNING: Any manual changes made to this file will be lost when pyuic5 is | ||
# run again. Do not edit this file unless you know what you are doing. | ||
|
||
|
||
from PyQt5 import QtCore, QtGui, QtWidgets | ||
|
||
|
||
class Ui_addUserDialog(object): | ||
def setupUi(self, addUserDialog): | ||
addUserDialog.setObjectName("addUserDialog") | ||
addUserDialog.resize(375, 232) | ||
addUserDialog.resize(375, 293) | ||
self.gridLayout = QtWidgets.QGridLayout(addUserDialog) | ||
self.gridLayout.setObjectName("gridLayout") | ||
self.verticalLayout = QtWidgets.QVBoxLayout() | ||
self.verticalLayout.setObjectName("verticalLayout") | ||
self.formLayout = QtWidgets.QFormLayout() | ||
self.formLayout.setFieldGrowthPolicy(QtWidgets.QFormLayout.ExpandingFieldsGrow) | ||
self.formLayout.setLabelAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) | ||
self.formLayout.setHorizontalSpacing(7) | ||
self.formLayout.setVerticalSpacing(14) | ||
self.formLayout.setObjectName("formLayout") | ||
self.usernameLabel = QtWidgets.QLabel(addUserDialog) | ||
self.usernameLabel.setObjectName("usernameLabel") | ||
self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.usernameLabel) | ||
self.username = QtWidgets.QLineEdit(addUserDialog) | ||
self.username.setObjectName("username") | ||
self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.username) | ||
self.fullnamelabel = QtWidgets.QLabel(addUserDialog) | ||
self.fullnamelabel.setObjectName("fullnamelabel") | ||
self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.fullnamelabel) | ||
self.fullname = QtWidgets.QLineEdit(addUserDialog) | ||
self.fullname.setText("") | ||
self.fullname.setObjectName("fullname") | ||
self.formLayout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.fullname) | ||
self.emailIDLabel = QtWidgets.QLabel(addUserDialog) | ||
self.emailIDLabel.setObjectName("emailIDLabel") | ||
self.formLayout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.emailIDLabel) | ||
self.emailid = QtWidgets.QLineEdit(addUserDialog) | ||
self.emailid.setObjectName("emailid") | ||
self.formLayout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.emailid) | ||
self.formLayout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.emailid) | ||
self.passwordLabel = QtWidgets.QLabel(addUserDialog) | ||
self.passwordLabel.setObjectName("passwordLabel") | ||
self.formLayout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.passwordLabel) | ||
self.formLayout.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.passwordLabel) | ||
self.password = QtWidgets.QLineEdit(addUserDialog) | ||
self.password.setEchoMode(QtWidgets.QLineEdit.Password) | ||
self.password.setObjectName("password") | ||
self.formLayout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.password) | ||
self.formLayout.setWidget(4, QtWidgets.QFormLayout.FieldRole, self.password) | ||
self.confirmPasswordLabel = QtWidgets.QLabel(addUserDialog) | ||
self.confirmPasswordLabel.setObjectName("confirmPasswordLabel") | ||
self.formLayout.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.confirmPasswordLabel) | ||
self.formLayout.setWidget(5, QtWidgets.QFormLayout.LabelRole, self.confirmPasswordLabel) | ||
self.rePassword = QtWidgets.QLineEdit(addUserDialog) | ||
self.rePassword.setEchoMode(QtWidgets.QLineEdit.Password) | ||
self.rePassword.setObjectName("rePassword") | ||
self.formLayout.setWidget(4, QtWidgets.QFormLayout.FieldRole, self.rePassword) | ||
self.emailIDLabel = QtWidgets.QLabel(addUserDialog) | ||
self.emailIDLabel.setObjectName("emailIDLabel") | ||
self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.emailIDLabel) | ||
self.usernameLabel = QtWidgets.QLabel(addUserDialog) | ||
self.usernameLabel.setObjectName("usernameLabel") | ||
self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.usernameLabel) | ||
self.formLayout.setWidget(5, QtWidgets.QFormLayout.FieldRole, self.rePassword) | ||
self.verticalLayout_2 = QtWidgets.QVBoxLayout() | ||
self.verticalLayout_2.setObjectName("verticalLayout_2") | ||
self.formLayout.setLayout(6, QtWidgets.QFormLayout.FieldRole, self.verticalLayout_2) | ||
self.verticalLayout.addLayout(self.formLayout) | ||
self.buttonBox = QtWidgets.QDialogButtonBox(addUserDialog) | ||
self.buttonBox.setOrientation(QtCore.Qt.Horizontal) | ||
|
@@ -56,18 +70,21 @@ def setupUi(self, addUserDialog): | |
self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1) | ||
|
||
self.retranslateUi(addUserDialog) | ||
self.buttonBox.accepted.connect(addUserDialog.accept) | ||
self.buttonBox.rejected.connect(addUserDialog.reject) | ||
self.buttonBox.accepted.connect(addUserDialog.accept) # type: ignore | ||
self.buttonBox.rejected.connect(addUserDialog.reject) # type: ignore | ||
QtCore.QMetaObject.connectSlotsByName(addUserDialog) | ||
|
||
def retranslateUi(self, addUserDialog): | ||
_translate = QtCore.QCoreApplication.translate | ||
addUserDialog.setWindowTitle(_translate("addUserDialog", "Add user")) | ||
self.usernameLabel.setText(_translate("addUserDialog", "Username:")) | ||
self.username.setPlaceholderText(_translate("addUserDialog", "John Doe")) | ||
self.fullnamelabel.setText(_translate("addUserDialog", "Fullname:")) | ||
self.fullname.setPlaceholderText(_translate("addUserDialog", "John Michael Doe")) | ||
self.emailIDLabel.setText(_translate("addUserDialog", "Email:")) | ||
self.emailid.setPlaceholderText(_translate("addUserDialog", "[email protected]")) | ||
self.passwordLabel.setText(_translate("addUserDialog", "Password:")) | ||
self.password.setPlaceholderText(_translate("addUserDialog", "Your password")) | ||
self.confirmPasswordLabel.setText(_translate("addUserDialog", "Confirm Password:")) | ||
self.rePassword.setPlaceholderText(_translate("addUserDialog", "Confirm your password")) | ||
self.emailIDLabel.setText(_translate("addUserDialog", "Email:")) | ||
self.usernameLabel.setText(_translate("addUserDialog", "Username:")) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this section is not needed, likly this comes from an option of the pyuic5 command. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do you mean all the changes in ui_add_user_dialog.py is not needed?? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add only the fullname There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is needed, why?