新增密码修改

This commit is contained in:
tonquer 2022-03-20 10:56:22 +08:00
parent 37c9681a0a
commit e7974eb8d6
13 changed files with 219 additions and 29 deletions

2
.gitignore vendored
View File

@ -8,6 +8,7 @@ __pycache__/
# Distribution / packaging
.Python
src/data/chat
.idea/
build/
develop-eggs/
@ -137,3 +138,4 @@ history.db
# Downloaded Commies for PicACG
commies/
test/
src/data/cache_word

View File

@ -12,6 +12,8 @@
# 6) 修复注册可能出现日期错误的问题
# 7) 修改了软件设置保留目录windows修改为当前目录data下
# 8) 修复多屏幕可能出现的鼠标指针错误
# 9) 新增密码修改功能
# 10) 修复一些下载问题
# Version: v1.3.5
# 2022/1/30

View File

@ -11,7 +11,7 @@ class GifLabel(QLabel):
self.bBuffer = None
self.setAttribute(Qt.WA_TranslucentBackground)
self.setWindowFlags(self.windowFlags() | Qt.FramelessWindowHint)
self.movie.frameChanged.connect(self.FrameChange)
# self.movie.frameChanged.connect(self.FrameChange)
def FrameChange(self):
currentPixmap = self.movie.currentPixmap()

View File

@ -0,0 +1,80 @@
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'ui_change_password_widget.ui'
##
## Created by: Qt User Interface Compiler version 6.2.2
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
QMetaObject, QObject, QPoint, QRect,
QSize, QTime, QUrl, Qt)
from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
QFont, QFontDatabase, QGradient, QIcon,
QImage, QKeySequence, QLinearGradient, QPainter,
QPalette, QPixmap, QRadialGradient, QTransform)
from PySide6.QtWidgets import (QApplication, QLabel, QLineEdit, QSizePolicy,
QSpacerItem, QVBoxLayout, QWidget)
class Ui_ChangePasswordWidget(object):
def setupUi(self, ChangePasswordWidget):
if not ChangePasswordWidget.objectName():
ChangePasswordWidget.setObjectName(u"ChangePasswordWidget")
ChangePasswordWidget.resize(400, 300)
self.verticalLayout_2 = QVBoxLayout(ChangePasswordWidget)
self.verticalLayout_2.setSpacing(12)
self.verticalLayout_2.setObjectName(u"verticalLayout_2")
self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
self.verticalLayout_2.addItem(self.verticalSpacer)
self.label_5 = QLabel(ChangePasswordWidget)
self.label_5.setObjectName(u"label_5")
self.verticalLayout_2.addWidget(self.label_5)
self.userEdit = QLineEdit(ChangePasswordWidget)
self.userEdit.setObjectName(u"userEdit")
self.verticalLayout_2.addWidget(self.userEdit)
self.label_6 = QLabel(ChangePasswordWidget)
self.label_6.setObjectName(u"label_6")
self.verticalLayout_2.addWidget(self.label_6)
self.passwordEdit = QLineEdit(ChangePasswordWidget)
self.passwordEdit.setObjectName(u"passwordEdit")
self.passwordEdit.setEchoMode(QLineEdit.Normal)
self.verticalLayout_2.addWidget(self.passwordEdit)
self.label = QLabel(ChangePasswordWidget)
self.label.setObjectName(u"label")
self.verticalLayout_2.addWidget(self.label)
self.newPasswordEdit = QLineEdit(ChangePasswordWidget)
self.newPasswordEdit.setObjectName(u"newPasswordEdit")
self.verticalLayout_2.addWidget(self.newPasswordEdit)
self.verticalSpacer_2 = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
self.verticalLayout_2.addItem(self.verticalSpacer_2)
self.retranslateUi(ChangePasswordWidget)
QMetaObject.connectSlotsByName(ChangePasswordWidget)
# setupUi
def retranslateUi(self, ChangePasswordWidget):
ChangePasswordWidget.setWindowTitle(QCoreApplication.translate("ChangePasswordWidget", u"Form", None))
self.label_5.setText(QCoreApplication.translate("ChangePasswordWidget", u"\u7528\u6237\u540d", None))
self.label_6.setText(QCoreApplication.translate("ChangePasswordWidget", u"\u5bc6\u7801", None))
self.label.setText(QCoreApplication.translate("ChangePasswordWidget", u"\u65b0\u5bc6\u7801", None))
# retranslateUi

View File

@ -18,6 +18,7 @@ from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
from PySide6.QtWidgets import (QApplication, QDialog, QHBoxLayout, QPushButton,
QSizePolicy, QTabWidget, QVBoxLayout, QWidget)
from view.user.change_password_widget import ChangePasswordWidget
from view.user.login_proxy_widget import LoginProxyWidget
from view.user.login_widget import LoginWidget
from view.user.register_widget import RegisterWidget
@ -44,6 +45,9 @@ class Ui_Login(object):
self.tab_2 = RegisterWidget()
self.tab_2.setObjectName(u"tab_2")
self.tabWidget.addTab(self.tab_2, "")
self.tab_4 = ChangePasswordWidget()
self.tab_4.setObjectName(u"tab_4")
self.tabWidget.addTab(self.tab_4, "")
self.tab_3 = LoginProxyWidget()
self.tab_3.setObjectName(u"tab_3")
self.tabWidget.addTab(self.tab_3, "")
@ -81,6 +85,7 @@ class Ui_Login(object):
Login.setWindowTitle(QCoreApplication.translate("Login", u"Dialog", None))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), QCoreApplication.translate("Login", u"\u767b\u5f55", None))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), QCoreApplication.translate("Login", u"\u6ce8\u518c", None))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_4), QCoreApplication.translate("Login", u"\u4fee\u6539\u5bc6\u7801", None))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_3), QCoreApplication.translate("Login", u"\u5206\u6d41", None))
self.loginButton.setText(QCoreApplication.translate("Login", u"\u786e\u5b9a", None))
#if QT_CONFIG(shortcut)

View File

@ -327,7 +327,7 @@ class Ui_ReadImg(object):
self.horizontalLayout_12.setObjectName(u"horizontalLayout_12")
self.label_10 = QLabel(self.scrollAreaWidgetContents)
self.label_10.setObjectName(u"label_10")
self.label_10.setMaximumSize(QSize(90, 16777215))
self.label_10.setMaximumSize(QSize(16777215, 16777215))
self.horizontalLayout_12.addWidget(self.label_10)
@ -346,7 +346,7 @@ class Ui_ReadImg(object):
self.horizontalLayout_13.setObjectName(u"horizontalLayout_13")
self.label_11 = QLabel(self.scrollAreaWidgetContents)
self.label_11.setObjectName(u"label_11")
self.label_11.setMaximumSize(QSize(90, 16777215))
self.label_11.setMaximumSize(QSize(16777215, 16777215))
self.horizontalLayout_13.addWidget(self.label_11)

View File

@ -117,8 +117,8 @@ class ChangePasswordReq(ServerReq):
"new_password": newPassword,
"old_password": oldPassword
}
url = config.Url + "user/password"
method = "POST"
url = config.Url + "users/password"
method = "PUT"
hearder = ToolUtil.GetHeader(url, method)
super(self.__class__, self).__init__(url, hearder, data, method)
self.token = token

View File

@ -49,9 +49,9 @@ class ChatMsgWidget(QtWidgets.QWidget, Ui_ChatRoomMsg):
# }
# """)
self.replayLabel.setWordWrap(True)
font = QFont("MicrosoftYaHei", 14, 100)
self.replayLabel.setFont(font)
self.commentLabel.setFont(font)
# font = QFont("MicrosoftYaHei", 14, 100)
# self.replayLabel.setFont(font)
# self.commentLabel.setFont(font)
# self.replayLabel.setStyleSheet("""
# border-image:url(:png/icon/skin_aio_friend_bubble_pressed.9.png) 50;
# border-top-width: 25px;

View File

@ -4,17 +4,17 @@ from PySide6.QtCore import Qt, QRegularExpression
from PySide6.QtGui import QRegularExpressionValidator
from component.label.msg_label import MsgLabel
from interface.ui_register_widget import Ui_RegisterWidget
from interface.ui_change_password_widget import Ui_ChangePasswordWidget
from qt_owner import QtOwner
from server import req, Status
from task.qt_task import QtTaskBase
from tools.str import Str
class ChangePasswordWidget(QtWidgets.QWidget, Ui_RegisterWidget, QtTaskBase):
class ChangePasswordWidget(QtWidgets.QWidget, Ui_ChangePasswordWidget, QtTaskBase):
def __init__(self):
super(self.__class__, self).__init__()
Ui_RegisterWidget.__init__(self)
Ui_ChangePasswordWidget.__init__(self)
QtTaskBase.__init__(self)
self.setupUi(self)
self.token = ""
@ -24,21 +24,21 @@ class ChangePasswordWidget(QtWidgets.QWidget, Ui_RegisterWidget, QtTaskBase):
return
def ClickButton(self):
if self.token and self.userId:
self.ChangePassword()
userId = self.userEdit.text()
old = self.passwordEdit.text()
new = self.passwordEdit.text()
if self.token and self.userId and self.userId == userId:
self.ChangePassword(old, new)
else:
self.Login()
def Login(self):
if not self.buttonGroup.checkedButton():
MsgLabel.ShowErrorEx(self, Str.GetStr(Str.NotSpace))
userId = self.userEdit.text()
oldPassword = self.passwordEdit.text()
newPassword = self.newPasswordEdit.text()
if not userId or not oldPassword or not newPassword:
QtOwner().ShowMsg(Str.GetStr(Str.NotSpace))
return
if len(self.passwdEdit.text()) < 8:
MsgLabel.ShowErrorEx(self, Str.GetStr(Str.PasswordShort))
return
userId = ""
oldPassword = ""
newPassword = ""
QtOwner().ShowLoading()
self.AddHttpTask(req.LoginReq(userId, oldPassword), self.LoginBack, (userId, oldPassword, newPassword))
return
@ -47,13 +47,12 @@ class ChangePasswordWidget(QtWidgets.QWidget, Ui_RegisterWidget, QtTaskBase):
QtOwner().CloseLoading()
st = raw["st"]
if st == Status.Ok:
QtOwner().ShowMsg(Str.GetStr(Str.RegisterSuc))
# QtOwner().ShowMsg(Str.GetStr(Str.RegisterSuc))
token = raw["token"]
self.token = token
userId, oldPassword, newPassword = v
self.userId = userId
self.ChangePassword()
self.AddHttpTask(req.ChangePasswordReq(oldPassword, newPassword), self.ChangePasswordBack)
self.ChangePassword(oldPassword, newPassword)
else:
msg = raw["data"]
QtOwner().ShowError(Str.GetStr(st) + "\n" + msg)
@ -66,8 +65,8 @@ class ChangePasswordWidget(QtWidgets.QWidget, Ui_RegisterWidget, QtTaskBase):
def ChangePasswordBack(self, raw):
QtOwner().CloseLoading()
st = raw["st"]
if st == Status.OK:
QtOwner().ShowMsg(Str.GetStr(Str.Success))
if st == Status.Ok:
QtOwner().ShowMsg(Str.GetStr(Str.Ok))
return
else:
msg = raw["data"]

View File

@ -47,9 +47,13 @@ class LoginView(BaseMaskDialog, Ui_Login, QtTaskBase):
return self.tabWidget.widget(1)
@property
def loginProxyWidget(self):
def changePasswordWidget(self):
return self.tabWidget.widget(2)
@property
def loginProxyWidget(self):
return self.tabWidget.widget(3)
def closeEvent(self, arg__1) -> None:
self.timer.stop()
return BaseMaskDialog.closeEvent(self, arg__1)
@ -69,6 +73,9 @@ class LoginView(BaseMaskDialog, Ui_Login, QtTaskBase):
self.loginButton.setText(Str.GetStr(Str.Register))
elif self.tabWidget.widget(index) == self.loginProxyWidget:
self.loginButton.setText(Str.GetStr(Str.Save))
elif self.tabWidget.widget(index) == self.changePasswordWidget:
self.loginButton.setText(Str.GetStr(Str.Save))
self.tabWidget.widget(index).Init()
def _ClickButton(self):

View File

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ChangePasswordWidget</class>
<widget class="QWidget" name="ChangePasswordWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>12</number>
</property>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>用户名</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="userEdit"/>
</item>
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>密码</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="passwordEdit">
<property name="echoMode">
<enum>QLineEdit::Normal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>新密码</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="newPasswordEdit"/>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -520,7 +520,7 @@
<widget class="QLabel" name="label_10">
<property name="maximumSize">
<size>
<width>90</width>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
@ -550,7 +550,7 @@
<widget class="QLabel" name="label_11">
<property name="maximumSize">
<size>
<width>90</width>
<width>16777215</width>
<height>16777215</height>
</size>
</property>

View File

@ -67,6 +67,11 @@
<string>注册</string>
</attribute>
</widget>
<widget class="ChangePasswordWidget" name="tab_4">
<attribute name="title">
<string>修改密码</string>
</attribute>
</widget>
<widget class="LoginProxyWidget" name="tab_3">
<attribute name="title">
<string>分流</string>
@ -131,6 +136,12 @@
<header location="global">view.user.login_proxy_widget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ChangePasswordWidget</class>
<extends>QWidget</extends>
<header location="global">view.user.change_password_widget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>